diff Modules/socketmodule.c @ 11268:3fe8d13328c8 legacy-trunk

It appears that inet_aton() doesn't really exist except in libresolv; the proper function to call is inet_addr(). Since we already had code to do that (for MS-Windows), this simplifies things a lot!
author Guido van Rossum <guido@python.org>
date Thu, 09 Sep 1999 15:42:59 +0000
parents 2d7331f4dfe3
children adf87d13a0c1
line wrap: on
line diff
--- a/Modules/socketmodule.c	Thu Sep 09 14:54:28 1999 +0000
+++ b/Modules/socketmodule.c	Thu Sep 09 15:42:59 1999 +0000
@@ -1807,26 +1807,10 @@
 static PyObject*
 BUILD_FUNC_DEF_2(PySocket_inet_aton, PyObject *, self, PyObject *, args)
 {
-#ifndef MS_WINDOWS
-	char *ip_addr;
-	struct in_addr packed_addr;
-	int err;
+#ifndef INADDR_NONE
+#define INADDR_NONE (-1)
+#endif
 
-	if (!PyArg_Parse(args, "s", &ip_addr)) {
-		return NULL;
-	}
-	
-	err = inet_aton(ip_addr, &packed_addr);
-
-	if (err == 0) {		/* invalid address */
-		PyErr_SetString(PySocket_Error,
-			"illegal IP address string passed to inet_aton");
-		return NULL;
-	}
-
-	return PyString_FromStringAndSize((char *) &packed_addr,
-					  sizeof(packed_addr));
-#else /* MS_WINDOWS */
 	/* Have to use inet_addr() instead */
 	char *ip_addr;
 	long packed_addr;
@@ -1845,7 +1829,6 @@
 
 	return PyString_FromStringAndSize((char *) &packed_addr,
 					  sizeof(packed_addr));
-#endif /* MS_WINDOWS */
 }
 
 static char inet_ntoa_doc[] =