]> Pileus Git - ~andy/fetchmail/commitdiff
inet_aton.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 4 Sep 1997 02:13:14 +0000 (02:13 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 4 Sep 1997 02:13:14 +0000 (02:13 -0000)
svn path=/trunk/; revision=1295

NEWS
configure.in
socket.c

diff --git a/NEWS b/NEWS
index 51306ed8212688ffc3c86d2033a50e323887a407..fb6d856c890511eccfeb79453e6f946ce96ea1c1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,9 @@
                                Release Notes:
 
 ------------------------------------------------------------------------------
+fetchmail-4.1.3 ()
+* Autoconfigure cortrectly for systems that lack inet_aton().
+
 fetchmail-4.1.2 (Wed Sep  3 18:44:58 EDT 1997)
 * Fixed a bonehead bug in RCPT TO name generation introduced in 4.1.1.
 * Added James Steven's ip-up wrapper to the contrib directory.
index 562f4fa98234d313054edd79f1360104a9dfc2b3..949e68c29c1c0d000f4eef5d1d4308275c82f3b7 100644 (file)
@@ -75,7 +75,8 @@ AC_SUBST(EXTRASRC)
 AC_SUBST(EXTRAOBJ)
 
 AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
-  strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit)
+  strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit \
+  inet_aton)
 
 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
 # and breaks gethostbyname(2).  It's better to use the bind stuff in the C
index 260d7cf24a44dc4e64d4ce5b4e4d50bb6a0643f7..ca4f0e165f007a904624358de8a474e55a35eb21 100644 (file)
--- a/socket.c
+++ b/socket.c
 #endif
 #include "socket.h"
 
+#ifndef INET_ATON
+#ifndef  INADDR_NONE
+#ifdef   INADDR_BROADCAST
+#define  INADDR_NONE   INADDR_BROADCAST
+#else
+#define         INADDR_NONE    -1
+#endif
+#endif
+#endif /* INET_ATON */
+
 #ifdef SUNOS
 #include <memory.h>
 #endif
 int SockOpen(char *host, int clientPort)
 {
     int sock;
+#ifndef INET_ATON
+    unsigned long inaddr;
+#endif /* INET_ATON */
     struct sockaddr_in ad;
     struct hostent *hp;
 
     memset(&ad, 0, sizeof(ad));
     ad.sin_family = AF_INET;
 
-    if (!inet_aton(host, &ad.sin_addr))        /* accept a quad address */
+    /* we'll accept a quad address */
+#ifndef INET_ATON
+    inaddr = inet_addr(host);
+    if (inaddr != INADDR_NONE)
+        memcpy(&ad.sin_addr, &inaddr, sizeof(inaddr));
+    else
+#else
+    if (!inet_aton(host, &ad.sin_addr))
+#endif /* INET_ATON */
     {
         hp = gethostbyname(host);