Initial revision
authorewt <devnull@localhost>
Sun, 29 Sep 1996 02:30:43 +0000 (02:30 +0000)
committerewt <devnull@localhost>
Sun, 29 Sep 1996 02:30:43 +0000 (02:30 +0000)
CVS patchset: 1078
CVS date: 1996/09/29 02:30:43

misc/inet_aton.c [new file with mode: 0644]
misc/inet_aton.h [new file with mode: 0644]

diff --git a/misc/inet_aton.c b/misc/inet_aton.c
new file mode 100644 (file)
index 0000000..5dfc5f7
--- /dev/null
@@ -0,0 +1,21 @@
+#ifdef HAVE_NETINET_IN_SYSTM_H
+# include <sys/types.h>
+# include <netinet/in_systm.h>
+#endif
+
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#include <arpa/inet.h>
+#include <string.h>
+
+#include "inet_aton.h"
+
+int inet_aton(const char *cp, struct in_addr *inp) {
+    long addr;
+
+    addr = inet_addr(cp);
+    if (addr == ((long) -1)) return 0;
+
+    memcpy(inp, &addr, sizeof(addr));
+    return 1;
+}
diff --git a/misc/inet_aton.h b/misc/inet_aton.h
new file mode 100644 (file)
index 0000000..fddbd1f
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef HAVE_INET_ATON
+
+int inet_aton(const char *cp, struct in_addr *inp);
+
+#endif