]> jfr.im git - irc/ircd-hybrid/libopm.git/commitdiff
Add configure check for inet_pton.
authorandy <redacted>
Mon, 16 Dec 2002 17:53:13 +0000 (17:53 +0000)
committerandy <redacted>
Mon, 16 Dec 2002 17:53:13 +0000 (17:53 +0000)
Rename inetpton() in inet.c to inet_pton() and only use it if build host
does not have its own inet_pton().

configure
configure.in
src/inet.c
src/inet.h
src/libopm.c
src/setup.h.in

index d45f0839c74aca1d68139d95a8d7fa28ac7fe447..b57cd1674885f41904144dab83284bbc4b195c95 100755 (executable)
--- a/configure
+++ b/configure
@@ -8141,7 +8141,8 @@ echo "$as_me: error: No select() implementation found" >&2;}
 fi
 
 
-for ac_func in inet_aton
+
+for ac_func in inet_aton inet_pton
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
index cb0511fc7e86d3dbfc380520ef4e0426e10a933a..b549a04a51be8998014670de44115ce82e700fec 100644 (file)
@@ -43,7 +43,7 @@ if test "$have_sys_poll_h" = "no"; then
  fi
 fi
 
-AC_CHECK_FUNCS(inet_aton)
+AC_CHECK_FUNCS(inet_aton inet_pton)
 
 dnl Check if we can use gethostbyname2 for ipv6
 AC_CHECK_FUNCS(gethostbyname gethostbyname2)
index 757e027d8495ee4ea99d3cb514d055c2804edbbf..ee6a7e11d8b16d08b5da85b47d9e454b1d6f284f 100644 (file)
@@ -315,7 +315,7 @@ const char *inetntop(int af, const void *src, char *dst, unsigned int size)
  */
 
 /* int
- * inetpton(af, src, dst)
+ * inet_pton(af, src, dst)
  *      convert from presentation format (which usually means ASCII printable)
  *      to network format (which is usually some kind of binary format).
  * return:
@@ -337,6 +337,8 @@ const char *inetntop(int af, const void *src, char *dst, unsigned int size)
  *      Paul Vixie, 1996.
  */
 
+#ifndef HAVE_INET_PTON
+
 static int inet_pton4(src, dst)
      const char *src;
      unsigned char *dst;
@@ -477,7 +479,8 @@ int i;
     memcpy(dst, tmp, IN6ADDRSZ);
     return (1);
 }
-#endif
+#endif /* IPv6 */
+
 int inetpton(af, src, dst) 
      int af;
      const char *src;
@@ -495,13 +498,15 @@ char tmp[HOSTIPLEN];
                 return (inet_pton6(tmp, dst));
             } else
                 return (inet_pton6(src, dst));
-#endif
+#endif /* IPv6 */
         default:
             return (-1);
     }
     /* NOTREACHED */
 }
 
+#endif
+
 /*
  * bopm_gethostbyname
  *
index e4ac5f154bb4b9f3bae283c83b2434a837361b03..9f2324e504733cfeb18341ff59def4ed7e33143d 100644 (file)
@@ -30,7 +30,9 @@ struct _opm_inaddr {
         struct in_addr in4;
 };
 
-extern int inetpton(int, const char *, void *);
+#ifndef HAVE_INET_PTON
+extern int inet_pton(int, const char *, void *);
+#endif
 extern const char *inetntop(int, const void *, char *, unsigned int);
 extern struct hostent *opm_gethostbyname(const char *);
 
index cd2f5d04c725f2ed12c0cef8744deb1fad7d6e89..c2cb7a7a88b8cbd2bb06f099e7ea99d9489e5b9f 100644 (file)
@@ -513,7 +513,7 @@ OPM_ERR_T opm_scan(OPM_T *scanner, OPM_REMOTE_T *remote)
 
    scan = libopm_scan_create(scanner, remote);
 
-   if(inetpton(AF_INET, remote->ip, &(scan->addr.sa4.sin_addr) ) <= 0)
+   if(inet_pton(AF_INET, remote->ip, &(scan->addr.sa4.sin_addr) ) <= 0)
    {
       libopm_scan_free(scan);
       return OPM_ERR_BADADDR;
index aabac92df0d2f9010bee352f8e83dc7d24f678e2..afe3a08dea6ddb395bd49a57c907b25e385c18da 100644 (file)
@@ -15,6 +15,9 @@
 /* Define to 1 if you have the `inet_aton' function. */
 #undef HAVE_INET_ATON
 
+/* Define to 1 if you have the `inet_pton' function. */
+#undef HAVE_INET_PTON
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H