add inet_network (required for wine)
authorrofl0r <retnyg@gmx.net>
Wed, 19 Dec 2012 06:32:38 +0000 (07:32 +0100)
committerrofl0r <retnyg@gmx.net>
Wed, 19 Dec 2012 06:32:38 +0000 (07:32 +0100)
include/arpa/inet.h
src/network/inet_network.c [new file with mode: 0644]

index 9293840..fdc501a 100644 (file)
@@ -24,6 +24,7 @@ uint32_t ntohl(uint32_t);
 uint16_t ntohs(uint16_t);
 
 in_addr_t inet_addr (const char *);
 uint16_t ntohs(uint16_t);
 
 in_addr_t inet_addr (const char *);
+in_addr_t inet_network (const char *);
 char *inet_ntoa (struct in_addr);
 int inet_pton (int, const char *__restrict, void *__restrict);
 const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
 char *inet_ntoa (struct in_addr);
 int inet_pton (int, const char *__restrict, void *__restrict);
 const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t);
diff --git a/src/network/inet_network.c b/src/network/inet_network.c
new file mode 100644 (file)
index 0000000..ae60d7f
--- /dev/null
@@ -0,0 +1,11 @@
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "__dns.h"
+
+in_addr_t inet_network(const char *p)
+{
+        struct sockaddr_in sin;
+        if (__ipparse(&sin, AF_INET, p)) return -1;
+        return ntohl(sin.sin_addr.s_addr);
+}