Make srvx compile on cygwin again.
authorMichael Poole <mdpoole@troilus.org>
Sun, 3 Sep 2006 15:24:48 +0000 (15:24 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sun, 3 Sep 2006 15:24:48 +0000 (15:24 +0000)
configure.in (AC_CHECK_HEADERS): Look for <arpa/inet.h>.
  (AC_CHECK_FUNCS): Look for inet_aton().

src/compat.c: Try to include <arpa/inet.h> 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

ChangeLog
configure.in
src/compat.c
src/compat.h
src/tools.c

index d513265dda0a551df25eadd48804e1fc4d9b7c26..83f0d1c1da1c3d9cfeed571ec49a665e5017fca0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,27 @@
 # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
 #
 
 # arch-tag: automatic-ChangeLog--srvx@srvx.net--2006/srvx--devo--1.3
 #
 
+2006-09-03 15:24:48 GMT        Michael Poole <mdpoole@troilus.org>     patch-30
+
+    Summary:
+      Make srvx compile on cygwin again.
+    Revision:
+      srvx--devo--1.3--patch-30
+
+    configure.in (AC_CHECK_HEADERS): Look for <arpa/inet.h>.
+      (AC_CHECK_FUNCS): Look for inet_aton().
+    
+    src/compat.c: Try to include <arpa/inet.h> 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 <mdpoole@troilus.org>     patch-29
 
     Summary:
 2006-09-03 15:21:10 GMT        Michael Poole <mdpoole@troilus.org>     patch-29
 
     Summary:
index 99a0c5da1cc4991809d54170dd8bb51ed7cdbad0..38bd08c76ab66333352898edafb1c302b7e26d6b 100644 (file)
@@ -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_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],
 
 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.
 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.]))
 
 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.]))
index b77aaae38424159d12e34f75743f21034ffb6b7f..d1c253f6b2ebf263287180f0515d733d5219c603 100644 (file)
@@ -11,6 +11,9 @@
 #ifdef HAVE_MEMORY_H
 # include <memory.h>
 #endif
 #ifdef HAVE_MEMORY_H
 # include <memory.h>
 #endif
+#ifdef HAVE_ARPA_INET_H
+# include <arpa/inet.h>
+#endif
 
 #if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME)
 extern gettimeofday(struct timeval * tv, struct timezone * tz);
 
 #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 (node) {
         if (hints && hints->ai_flags & AI_NUMERICHOST) {
+#if HAVE_INET_ATON
             if (!inet_aton(node, &sin.sin_addr))
                 return 2;
             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);
         } else {
             struct hostent *he;
             he = gethostbyname(node);
index 232af42ed6373465fb33a96062c751061a6a9051..dbc79315c91e3bed07ddfc0d0a5bc838260861b5 100644 (file)
@@ -110,6 +110,7 @@ struct addrinfo {
 
 #define AI_PASSIVE 1
 #define AI_CANONNAME 2
 
 #define AI_PASSIVE 1
 #define AI_CANONNAME 2
+#define AI_NUMERICHOST 4
 
 #endif /* !defined(HAVE_STRUCT_ADDRINFO) */
 
 
 #endif /* !defined(HAVE_STRUCT_ADDRINFO) */
 
index 0da95dd62006c2273139afd5d1fdc6251c9e3608..d4dee86d65e221cd39357f1121752dce95e845ad 100644 (file)
@@ -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) {
                 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);
         pos = irc_pton_ip4(input, bits, &ip4);
         if (pos) {
             addr->in6[5] = htons(65535);