diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1997-09-04 02:13:14 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1997-09-04 02:13:14 +0000 |
commit | b5de78b6bb3e35f019b6745aacc33612db160afc (patch) | |
tree | abc98933159782a2574571ca359cd73617961e2c | |
parent | 0fb53c7bb00e0057f0b5df5843a840ffcabd289a (diff) | |
download | fetchmail-b5de78b6bb3e35f019b6745aacc33612db160afc.tar.gz fetchmail-b5de78b6bb3e35f019b6745aacc33612db160afc.tar.bz2 fetchmail-b5de78b6bb3e35f019b6745aacc33612db160afc.zip |
inet_aton.
svn path=/trunk/; revision=1295
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | socket.c | 23 |
3 files changed, 27 insertions, 2 deletions
@@ -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. diff --git a/configure.in b/configure.in index 562f4fa9..949e68c2 100644 --- a/configure.in +++ b/configure.in @@ -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 @@ -25,6 +25,16 @@ #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 @@ -32,13 +42,24 @@ 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); |