From: Michael Poole Date: Sun, 3 Sep 2006 15:24:48 +0000 (+0000) Subject: Make srvx compile on cygwin again. X-Git-Tag: v1.4.0-rc1~126 X-Git-Url: http://git.pk910.de/?p=srvx.git;a=commitdiff_plain;h=23287685f2317345df2ba19ef650c220d7846817 Make srvx compile on cygwin again. configure.in (AC_CHECK_HEADERS): Look for . (AC_CHECK_FUNCS): Look for inet_aton(). src/compat.c: Try to include so we get inet_addr(). (getaddrinfo): If inet_aton() is not provided, use inet_addr() instead. src/compat.h (AI_NUMERICHOST): Define this too. src/tools.c (irc_pton): Use the pedantically correct type for ip4. git-archimport-id: srvx@srvx.net--2006/srvx--devo--1.3--patch-30 --- diff --git a/ChangeLog b/ChangeLog index d513265..83f0d1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,27 @@ # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3 # +2006-09-03 15:24:48 GMT Michael Poole patch-30 + + Summary: + Make srvx compile on cygwin again. + Revision: + srvx--devo--1.3--patch-30 + + configure.in (AC_CHECK_HEADERS): Look for . + (AC_CHECK_FUNCS): Look for inet_aton(). + + src/compat.c: Try to include so we get inet_addr(). + (getaddrinfo): If inet_aton() is not provided, use inet_addr() instead. + + src/compat.h (AI_NUMERICHOST): Define this too. + + src/tools.c (irc_pton): Use the pedantically correct type for ip4. + + modified files: + ChangeLog configure.in src/compat.c src/compat.h src/tools.c + + 2006-09-03 15:21:10 GMT Michael Poole patch-29 Summary: diff --git a/configure.in b/configure.in index 99a0c5d..38bd08c 100644 --- a/configure.in +++ b/configure.in @@ -69,7 +69,7 @@ AC_HEADER_TIME AC_STRUCT_TM dnl Would rather not bail on headers, BSD has alot of the functions elsewhere. -Jedi -AC_CHECK_HEADERS(fcntl.h malloc.h netdb.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h regex.h arpa/inet.h sys/mman.h sys/stat.h dirent.h,,) +AC_CHECK_HEADERS(fcntl.h malloc.h netdb.h arpa/inet.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h regex.h arpa/inet.h sys/mman.h sys/stat.h dirent.h,,) dnl portability stuff, hurray! -Jedi AC_CHECK_MEMBER([struct sockaddr.sa_len], @@ -87,7 +87,7 @@ if test $ac_cv_func_gettimeofday = no; then fi dnl We have fallbacks in case these are missing, so just check for them. -AC_CHECK_FUNCS(freeaddrinfo getaddrinfo getnameinfo getpagesize memcpy memset strdup strerror strsignal localtime_r setrlimit getopt getopt_long regcomp regexec regfree sysconf,,) +AC_CHECK_FUNCS(freeaddrinfo getaddrinfo getnameinfo getpagesize memcpy memset strdup strerror strsignal localtime_r setrlimit getopt getopt_long regcomp regexec regfree sysconf inet_aton,,) dnl Check for absolutely required library functions. AC_CHECK_FUNCS(select socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. srvx build will fail.])) diff --git a/src/compat.c b/src/compat.c index b77aaae..d1c253f 100644 --- a/src/compat.c +++ b/src/compat.c @@ -11,6 +11,9 @@ #ifdef HAVE_MEMORY_H # include #endif +#ifdef HAVE_ARPA_INET_H +# include +#endif #if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME) extern gettimeofday(struct timeval * tv, struct timezone * tz); @@ -363,8 +366,14 @@ int getaddrinfo(const char *node, const char *service, const struct addrinfo *hi if (node) { if (hints && hints->ai_flags & AI_NUMERICHOST) { +#if HAVE_INET_ATON if (!inet_aton(node, &sin.sin_addr)) return 2; +#else + sin.sin_addr.s_addr = inet_addr(node); + if (sin.sin_addr.s_addr == INADDR_NONE) + return 2; +#endif } else { struct hostent *he; he = gethostbyname(node); diff --git a/src/compat.h b/src/compat.h index 232af42..dbc7931 100644 --- a/src/compat.h +++ b/src/compat.h @@ -110,6 +110,7 @@ struct addrinfo { #define AI_PASSIVE 1 #define AI_CANONNAME 2 +#define AI_NUMERICHOST 4 #endif /* !defined(HAVE_STRUCT_ADDRINFO) */ diff --git a/src/tools.c b/src/tools.c index 0da95dd..d4dee86 100644 --- a/src/tools.c +++ b/src/tools.c @@ -313,7 +313,7 @@ irc_pton(irc_in_addr_t *addr, unsigned char *bits, const char *input) addr->in6[cpos + jj] = 0; } } else if (dot) { - unsigned int ip4; + uint32_t ip4; pos = irc_pton_ip4(input, bits, &ip4); if (pos) { addr->in6[5] = htons(65535);