summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2012-12-19 07:32:38 +0100
committerrofl0r <retnyg@gmx.net>2012-12-19 07:32:38 +0100
commit36d7303878a8827b706317383fc218529f432143 (patch)
treee0cbd314a58fe477d833f1538c39a08b41514028
parent3bb167b33818b3ac569f73a2ff82ff1ab3b04c4a (diff)
downloadmusl-36d7303878a8827b706317383fc218529f432143.tar.gz
add inet_network (required for wine)
-rw-r--r--include/arpa/inet.h1
-rw-r--r--src/network/inet_network.c11
2 files changed, 12 insertions, 0 deletions
diff --git a/include/arpa/inet.h b/include/arpa/inet.h
index 92938403..fdc501aa 100644
--- a/include/arpa/inet.h
+++ b/include/arpa/inet.h
@@ -24,6 +24,7 @@ uint32_t ntohl(uint32_t);
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);
diff --git a/src/network/inet_network.c b/src/network/inet_network.c
new file mode 100644
index 00000000..ae60d7f6
--- /dev/null
+++ b/src/network/inet_network.c
@@ -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);
+}