about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-12-19 13:07:37 -0500
committerRich Felker <dalias@aerifal.cx>2012-12-19 13:07:37 -0500
commit5d5ab51862cbd010bdf52dc3b04b0967450bcd1a (patch)
tree41431acff8952340f256f9eda10524fba048a0d2 /src
parent3c4214db727ed6300b34be28a5428b7abd6598df (diff)
parent3159e2fc816f5c56b54f86f38748ba1ff9e18f9f (diff)
downloadmusl-5d5ab51862cbd010bdf52dc3b04b0967450bcd1a.tar.gz
musl-5d5ab51862cbd010bdf52dc3b04b0967450bcd1a.tar.xz
musl-5d5ab51862cbd010bdf52dc3b04b0967450bcd1a.zip
merge a few fixes by sh4rm4
Diffstat (limited to 'src')
-rw-r--r--src/network/inet_network.c11
1 files changed, 11 insertions, 0 deletions
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);
+}