]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Compat: shuffle replacement OS function fiels into libcompat
authorAmos Jeffries <amosjeffries@squid-cache.org>
Mon, 22 Mar 2010 13:05:28 +0000 (07:05 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Mon, 22 Mar 2010 13:05:28 +0000 (07:05 -0600)
* strerror() is omitted due to an emulator, and multiple
  replacement functions being defined with rather complicated
  interactions.

* the .c parts must also remain in lib/ for now to simplify
  autoconf logics.

45 files changed:
CREDITS
compat/Makefile.am
compat/compat_shared.h
compat/drand48.h [new file with mode: 0644]
compat/eui64_aton.h [moved from include/eui64_aton.h with 91% similarity]
compat/getaddrinfo.h [moved from include/getaddrinfo.h with 95% similarity]
compat/getnameinfo.h [moved from include/getnameinfo.h with 78% similarity]
compat/inet_ntop.h [moved from include/inet_ntop.h with 85% similarity]
compat/inet_pton.h [moved from include/inet_pton.h with 89% similarity]
compat/initgroups.h [moved from include/initgroups.h with 54% similarity]
compat/os/mswin.h
compat/os/netbsd.h
compat/strsep.h [moved from include/strsep.h with 58% similarity]
compat/strtoll.h [new file with mode: 0644]
compat/tempnam.h [moved from include/tempnam.h with 86% similarity]
helpers/negotiate_auth/kerberos/negotiate_kerberos_auth.cc
include/strtoll.h [deleted file]
include/util.h
lib/getaddrinfo.c
lib/getfullhostname.c
lib/getnameinfo.c
lib/initgroups.c
lib/rfc3596.c
lib/strerror.c
lib/strsep.c
lib/strtoll.c
lib/tempnam.c
src/HttpHeaderTools.cc
src/Parsing.cc
src/SwapDir.cc
src/acl/Ip.cc
src/client_side_request.cc
src/dnsserver.cc
src/eui/Eui64.cc
src/event.cc
src/ftp.cc
src/ip/IpAddress.cc
src/ip/IpAddress.h
src/ip/testIpAddress.cc
src/snmp_core.cc
src/squid.h
src/tools.cc
src/wccp2.cc
test-suite/pconn-banger.c
tools/cachemgr.cc

diff --git a/CREDITS b/CREDITS
index 68e7936000843262f5dca37ec1741f7489dc9289..df3b54ba1cb23f342309f956bb81b5383e5db0d2 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -463,3 +463,26 @@ helprs/negotiate_auth/kerberos/ *
  */
 
 ==============================================================================
+
+compat/strsep.h, lib/strsep.c
+
+ * Copyright (C) 2004 Free Software Foundation, Inc.
+ * Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
+ * 
+ * The file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+
+==============================================================================
+
index 4c9f8e2404a21dd7629a85281f953c438db157c0..af4b66a197bf4e6a3c19c965570ea45a4a532dc1 100644 (file)
@@ -10,15 +10,24 @@ include $(top_srcdir)/src/Common.am
 # Port Specific Configurations
 
 noinst_LTLIBRARIES = libcompat.la
-
 libcompat_la_SOURCES = \
        assert.h \
        compat.h \
        compat_shared.h \
        debug.h \
+       drand48.h \
+       eui64_aton.h \
        fdsetsize.h \
+       getaddrinfo.h \
+       getnameinfo.h \
+       inet_ntop.h \
+       inet_pton.h \
+       initgroups.h \
        osdetect.h \
        stdvarargs.h \
+       strsep.h \
+       strtoll.h \
+       tempnam.h \
        types.h \
        unsafe.h \
        valgrind.h \
index 95c54e72244bf86cf68498ee812562b460301440..753396e38e0adf66bdd2c2bdca1736680229c778 100644 (file)
@@ -134,43 +134,11 @@ max(A const & lhs, A const & rhs)
 #endif /* __cplusplus */
 #endif /* max */
 
-/**
- * tempnam() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_TEMPNAM
-#include "tempnam.h"
-#endif
-
-/**
- * strsep() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_STRSEP
-#include "strsep.h"
-#endif
-
-/**
- * strtoll() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_STRTOLL
-#include "strtoll.h"
-#endif
-
 /**
  * Common shared definition of what whitespace consists of for string tests
  */
 #define w_space     " \t\n\r"
 
-/**
- * initgroups() not provided by all systems
- * TODO: detect WHICH systems and move to their OS-specific compat files
- */
-#if !HAVE_INITGROUPS
-#include "initgroups.h"
-#endif
-
 
 #ifndef SQUID_NONBLOCK
 /* REQUIRED for the below logics. If they move this needs to as well */
diff --git a/compat/drand48.h b/compat/drand48.h
new file mode 100644 (file)
index 0000000..362d124
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _SQUID_DRAND48_H
+#define _SQUID_DRAND48_H
+
+#if !HAVE_DRAND48
+#define HAVE_DRAND48 1
+SQUIDCEXTERN double drand48(void);
+#endif
+
+#endif
similarity index 91%
rename from include/eui64_aton.h
rename to compat/eui64_aton.h
index 280de84ff62ee43abe0424a420493b467281eeb7..98caeeed1a5f13a68dcf595800e82b5d603aa9c2 100644 (file)
@@ -1,3 +1,12 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+/* If we have this system file use it. Otherwise use the below definitions. */
+#if HAVE_SYS_EUI64_H
+#include <sys/eui64.h>
+#else
+
 /*
  * Squid Change History:
  *
@@ -38,8 +47,6 @@
 #ifndef _SYS_EUI64_H
 #define _SYS_EUI64_H
 
-#include <sys/types.h>
-
 /**
  * Size of the ASCII representation of an EUI-64.
  */
@@ -63,3 +70,4 @@ extern "C"
 int eui64_aton(const char *a, struct eui64 *e);
 
 #endif /* !_SYS_EUI64_H */
+#endif /* HAVE_SYS_EUI64_H */
similarity index 95%
rename from include/getaddrinfo.h
rename to compat/getaddrinfo.h
index a0aabf7347290d78a6b63063cc9e03ff33dd4b44..96e42aaf8603ff3b8544d779b94f32707355b2f7 100644 (file)
@@ -1,3 +1,7 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
 #ifndef _getaddrinfo_h
 #define _getaddrinfo_h
 
@@ -18,8 +22,6 @@
  *  Original License and code follows.
  */
 
-#include "config.h"
-
 /*
  *  This file is part of libESMTP, a library for submission of RFC 2822
  *  formatted electronic mail messages using the SMTP protocol described
 
 /* Structure and prototypes taken from RFC 2553 */
 
-#ifdef HAVE_GETADDRINFO
-
 /* These functions are provided by the OS */
-#define xgetaddrinfo   getaddrinfo
-#define xfreeaddrinfo  freeaddrinfo
-#define xgai_strerror  gai_strerror
-
-#else /* !HAVE_GETADDRINFO */
+#if !HAVE_GETADDRINFO
 
 /* SG 23/09/2007:
 On Windows the following definitions are already available, may be that
@@ -102,13 +98,15 @@ struct addrinfo {
 /* RFC 2553 / Posix resolver */
 SQUIDCEXTERN int xgetaddrinfo (const char *nodename, const char *servname,
                                const struct addrinfo *hints, struct addrinfo **res);
+#define getaddrinfo    xgetaddrinfo
 
 /* Free addrinfo structure and associated storage */
 SQUIDCEXTERN void xfreeaddrinfo (struct addrinfo *ai);
+#define freeaddrinfo   xfreeaddrinfo
 
 /* Convert error return from getaddrinfo() to string */
 SQUIDCEXTERN const char *xgai_strerror (int code);
+#define gai_strerror   xgai_strerror
 
 #endif /* HAVE_GETADDRINFO */
-
-#endif
+#endif /* _getaddrinfo_h */
similarity index 78%
rename from include/getnameinfo.h
rename to compat/getnameinfo.h
index 7d9c750871f961bd0757409b66f7cc7eb9a7c003..0c1bba9a3912dfa6435d4708bc82667ba61f5a69 100644 (file)
@@ -1,19 +1,14 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
 #ifndef _getnameinfo_h
 #define _getnameinfo_h
 /*
  * Reconstructed from KAME getnameinfo.c (in lib/)
- *
- * $Id$
  */
 
-#include "config.h"
-
-#ifdef HAVE_GETNAMEINFO
-
-/* These functions are provided by the OS */
-#define xgetnameinfo   getnameinfo
-
-#else /* !HAVE_GETNAMEINFO */
+#if !HAVE_GETNAMEINFO
 
 /* RFC 2553 / Posix resolver */
 SQUIDCEXTERN int xgetnameinfo(const struct sockaddr *sa,
@@ -23,8 +18,8 @@ SQUIDCEXTERN int xgetnameinfo(const struct sockaddr *sa,
                               char *serv,
                               size_t servlen,
                               int flags );
+#define getnameinfo    xgetnameinfo
 
 
 #endif /* HAVE_GETNAMEINFO */
-
-#endif
+#endif /* _getnameinfo_h */
similarity index 85%
rename from include/inet_ntop.h
rename to compat/inet_ntop.h
index a7bf206224b4e14c0a19fc25a512cb083266a99a..e9cbe4b6d1793ce942c4dab2a89951419a36671e 100644 (file)
@@ -1,14 +1,12 @@
-#ifndef _INC_INET_NTOP_H
-#define _INC_INET_NTOP_H
-
+#ifndef SQUID_CONFIG_H
 #include "config.h"
+#endif
 
-#if HAVE_INET_NTOP
+#ifndef _INC_INET_NTOP_H
+#define _INC_INET_NTOP_H
 
 /* Use the system provided version where possible */
-#define xinet_ntop inet_ntop
-
-#else
+#if !HAVE_INET_NTOP
 
 /* char *
 * inet_ntop(af, src, dst, size)
@@ -19,7 +17,7 @@
 *      Paul Vixie, 1996.
 */
 SQUIDCEXTERN const char * xinet_ntop(int af, const void *src, char *dst, size_t size);
+#define inet_ntop xinet_ntop
 
 #endif
-
 #endif /* _INC_INET_NTOP_H */
similarity index 89%
rename from include/inet_pton.h
rename to compat/inet_pton.h
index 5c95540dfa73f0062c7328c4d701305e55fcdf61..b80dc855bef8cb84b3fde55746a7f72df1cdfd5b 100644 (file)
@@ -1,14 +1,12 @@
-#ifndef _INC_INET_PTON_H
-#define _INC_INET_PTON_H
-
+#ifndef SQUID_CONFIG_H
 #include "config.h"
+#endif
 
-#if HAVE_INET_PTON
+#ifndef _INC_INET_PTON_H
+#define _INC_INET_PTON_H
 
 /* Use the system provided version where possible */
-#define xinet_pton inet_pton
-
-#else
+#if !HAVE_INET_PTON
 
 /* int
 * inet_pton(af, src, dst)
@@ -22,7 +20,7 @@
 *      Paul Vixie, 1996.
 */
 SQUIDCEXTERN int xinet_pton(int af, const char *src, void *dst);
+#define inet_pton xinet_pton
 
 #endif
-
 #endif /* _INC_INET_NTOP_H */
similarity index 54%
rename from include/initgroups.h
rename to compat/initgroups.h
index 49b1d158d0c13d16d928b9515603aeb73084d36f..f67ff9a65e57d548c6669abce909b97c749a44db 100644 (file)
@@ -1,20 +1,13 @@
-/*
- * $Id$
- */
-#ifndef SQUID_INITGROUPS_H
-#define SQUID_INITGROUPS_H
-
-#include "config.h"
-
-/* if you have configure you can use this */
-#if defined(HAVE_CONFIG_H)
+#ifndef SQUID_CONFIG_H
 #include "config.h"
 #endif
 
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
+#ifndef SQUID_INITGROUPS_H
+#define SQUID_INITGROUPS_H
+
+#if !HAVE_INITGROUPS
 
 SQUIDCEXTERN int initgroups(const char *user, gid_t group);
 
+#endif
 #endif /* SQUID_INITGROPS_H */
index aa90975208a8da3c3028e84fabfe73f1c0ae0033..6d9d58be829035273c50add19dd407cdb3fef61d 100644 (file)
@@ -323,6 +323,7 @@ SQUIDCEXTERN int _free_osfhnd(int);
 SQUIDCEXTERN THREADLOCAL int ws32_result;
 
 #define strerror(e) WIN32_strerror(e)
+#define HAVE_STRERROR 1
 
 #ifdef __cplusplus
 
index 300f2d364676404f0720b61b3a42a961fd7d3b0a..dfc54b5b4b7b66bf7b7ba031d1e51886e84f77d5 100644 (file)
@@ -19,5 +19,8 @@
 #define SQUID_NO_ALLOC_PROTECT 1
 #endif
 
+/* NetBSD does not provide sys_errlist global for strerror */
+#define NEED_SYS_ERRLIST 1
+
 #endif /* _SQUID_NETBSD_ */
 #endif /* SQUID_OS_NETBSD_H */
similarity index 58%
rename from include/strsep.h
rename to compat/strsep.h
index 40d2ad22e2a3a50be2a6fe5213b5785491c4d417..87d1c71bc90bc98b86899ad969511a50fac2172b 100644 (file)
@@ -1,3 +1,7 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
 /* Copyright (C) 2004 Free Software Foundation, Inc.
  * Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
  *
@@ -19,8 +23,6 @@
 #ifndef GNULIB_STRSEP_H_
 #define GNULIB_STRSEP_H_
 
-#include "config.h"
-
 #if HAVE_STRSEP
 
 /*
 #else
 
 /**
-\par
-Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
-If one is found, it is overwritten with a NULL, and *STRINGP is advanced
-to point to the next char after it.  Otherwise, *STRINGP is set to NULL.
-If *STRINGP was already NULL, nothing happens.
-Returns the old value of *STRINGP.
-\par
-This is a variant of strtok() that is multithread-safe and supports
-empty fields.
-
-\note   Caveat: It modifies the original string.
-\note   Caveat: These functions cannot be used on constant strings.
-\note   Caveat: The identity of the delimiting character is lost.
-\note   Caveat: It doesn't work with multibyte strings unless all of the delimiter
-characters are ASCII characters < 0x30.
-
-See also strtok_r().
-*/
+ *\par
+ * Searches the next delimiter (char listed in DELIM) starting at *STRINGP.
+ * If one is found, it is overwritten with a NULL, and *STRINGP is advanced
+ * to point to the next char after it.  Otherwise, *STRINGP is set to NULL.
+ * If *STRINGP was already NULL, nothing happens.
+ * Returns the old value of *STRINGP.
+ * 
+ *\par
+ * This is a variant of strtok() that is multithread-safe and supports
+ * empty fields.
+ * 
+ * \note   Caveat: It modifies the original string.
+ * \note   Caveat: These functions cannot be used on constant strings.
+ * \note   Caveat: The identity of the delimiting character is lost.
+ * \note   Caveat: It doesn't work with multibyte strings unless all of the delimiter
+ * characters are ASCII characters < 0x30.
+ * 
+ * See also strtok_r().
+ */
 SQUIDCEXTERN char *strsep(char **stringp, const char *delim);
 
 #endif /* HAVE_STRSEP */
-
 #endif /* GNULIB_STRSEP_H_ */
diff --git a/compat/strtoll.h b/compat/strtoll.h
new file mode 100644 (file)
index 0000000..60c04c2
--- /dev/null
@@ -0,0 +1,21 @@
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
+
+#ifndef _SQUID_COMPAT_STRTOLL_H
+#define _SQUID_COMPAT_STRTOLL_H
+
+#if !HAVE_STRTOLL
+
+/**
+ *\par
+ * Convert a string to a int64 integer.
+ * 
+ *\par
+ * Ignores `locale' stuff.  Assumes that the upper and lower case
+ * alphabets and digits are each contiguous.
+ */
+SQUIDCEXTERN int64_t strtoll(const char *nptr, char **endptr, int base);
+
+#endif /* !HAVE_STRTOLL */
+#endif /* _SQUID_COMPAT_STRTOLL_H */
similarity index 86%
rename from include/tempnam.h
rename to compat/tempnam.h
index f8e4ae6b58e2e4f7bcc4a7cc20efd685ef49c798..ab1d4c29e3ff9bf0a191645a5de0067547343c9f 100644 (file)
@@ -1,9 +1,5 @@
 /*
- * $Id$
- */
-
-
-/* Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
+ * Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  * This file is part of the GNU C Library.
  * The GNU C Library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public License as
  * You should have received a copy of the GNU Library General Public
  * License along with the GNU C Library; see the file COPYING.LIB.  If
  * not, write to the Free Software Foundation, Inc., 675 Mass Ave,
- * Cambridge, MA 02139, USA.  */
+ * Cambridge, MA 02139, USA.
+ */
+
+#ifndef SQUID_CONFIG_H
+#include "config.h"
+#endif
 
 #ifndef SQUID_TEMPNAM_H
 #define SQUID_TEMPNAM_H
+
 extern char *tempnam(const char *, const char *);
+
 #endif /* SQUID_TEMPNAM_H */
index 1f575736a27ab6ba155d00390092c1160c5ae163..b48ebdc089dd64fda7a488468aa2c64dbd4d2b3e 100644 (file)
@@ -30,6 +30,8 @@
  * Hosted at http://sourceforge.net/projects/squidkerbauth
  */
 #include "config.h"
+#include "compat/getaddrinfo.h"
+#include "compat/getnameinfo.h"
 
 #if HAVE_GSSAPI
 
@@ -57,8 +59,6 @@
 
 #include "util.h"
 #include "base64.h"
-#include "getaddrinfo.h"
-#include "getnameinfo.h"
 
 #if HAVE_GSSAPI_GSSAPI_H
 #include <gssapi/gssapi.h>
@@ -124,11 +124,11 @@ gethost_name(void)
                 LogTime(), PROGRAM, hostname);
         return NULL;
     }
-    rc = xgetaddrinfo(hostname, NULL, NULL, &hres);
+    rc = getaddrinfo(hostname, NULL, NULL, &hres);
     if (rc != 0) {
         fprintf(stderr,
                 "%s| %s: ERROR: resolving hostname with getaddrinfo: %s failed\n",
-                LogTime(), PROGRAM, xgai_strerror(rc));
+                LogTime(), PROGRAM, gai_strerror(rc));
         return NULL;
     }
     hres_list = hres;
@@ -137,17 +137,17 @@ gethost_name(void)
         count++;
         hres_list = hres_list->ai_next;
     }
-    rc = xgetnameinfo(hres->ai_addr, hres->ai_addrlen, hostname,
+    rc = getnameinfo(hres->ai_addr, hres->ai_addrlen, hostname,
                       sizeof(hostname), NULL, 0, 0);
     if (rc != 0) {
         fprintf(stderr,
                 "%s| %s: ERROR: resolving ip address with getnameinfo: %s failed\n",
-                LogTime(), PROGRAM, xgai_strerror(rc));
-        xfreeaddrinfo(hres);
+                LogTime(), PROGRAM, gai_strerror(rc));
+        freeaddrinfo(hres);
         return NULL;
     }
 
-    xfreeaddrinfo(hres);
+    freeaddrinfo(hres);
     hostname[sysconf(_SC_HOST_NAME_MAX) - 1] = '\0';
     return (xstrdup(hostname));
 }
diff --git a/include/strtoll.h b/include/strtoll.h
deleted file mode 100644 (file)
index 92e8edd..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * $Id$
- */
-#ifndef _SQUIDINC_STRTOLL_H
-#define _SQUIDINC_STRTOLL_H
-
-#include "config.h"
-
-#if HAVE_STRTOLL
-
-/*
- * Get strtoll() declaration.
- */
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-
-#else
-
-/**
-\par
-* Convert a string to a int64 integer.
-\par
-* Ignores `locale' stuff.  Assumes that the upper and lower case
-* alphabets and digits are each contiguous.
-*/
-SQUIDCEXTERN int64_t strtoll(const char *nptr, char **endptr, int base);
-
-#endif /* !HAVE_STRTOLL */
-
-#endif /* _SQUIDINC_STRTOLL_H */
index 0bf570b4c272bc99b2a012f74441aeb1f315c56e..f02e042435da153bea53e021820816f8bc04cf9c 100644 (file)
@@ -127,10 +127,6 @@ SQUIDCEXTERN double xdiv(double nom, double denom);
 SQUIDCEXTERN const char *xitoa(int num);
 SQUIDCEXTERN const char *xint64toa(int64_t num);
 
-#if !HAVE_DRAND48
-SQUIDCEXTERN double drand48(void);
-#endif
-
 typedef struct {
     size_t count;
     size_t bytes;
index 25917df2afe1521a9e55cfe85eb9468894507ab8..24d2d9bffd7d935b6ffb07debf9d56345d098ed7 100644 (file)
@@ -49,9 +49,9 @@
 #undef _POSIX_C_SOURCE
 #undef _XOPEN_SOURCE
 
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
+#include "compat/getaddrinfo.h"
+#include "compat/inet_pton.h"
+
 #if HAVE_STRING_H
 #include <string.h>
 #endif
@@ -61,7 +61,6 @@
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
-
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif
@@ -79,9 +78,6 @@
 #include <ws2tcpip.h>
 #endif
 
-#include "getaddrinfo.h"
-#include "inet_pton.h"
-
 static struct addrinfo *
 dup_addrinfo (struct addrinfo *info, void *addr, size_t addrlen) {
     struct addrinfo *ret;
@@ -168,7 +164,7 @@ xgetaddrinfo (const char *nodename, const char *servname,
         return (*res == NULL) ? EAI_MEMORY : 0;
     }
 
-    /* If AI_NUMERIC is specified, use xinet_pton to translate numbers and
+    /* If AI_NUMERIC is specified, use inet_pton to translate numbers and
        dots notation. */
     if (hints->ai_flags & AI_NUMERICHOST) {
         struct sockaddr_in sin;
@@ -181,7 +177,7 @@ xgetaddrinfo (const char *nodename, const char *servname,
 
         sin.sin_family = result.ai_family;
         sin.sin_port = htons (port);
-        if (xinet_pton(result.ai_family, nodename, &sin.sin_addr))
+        if (inet_pton(result.ai_family, nodename, &sin.sin_addr))
             return EAI_NONAME;
         sin.sin_addr.s_addr = inet_addr (nodename);
         /* Duplicate result and addr and return */
index 5348ad7ec11e2a8b3951bdc9d63ea9bf7ca42cc5..792f02bde412e7b2fc80010c2678f092e228fa25 100644 (file)
@@ -64,7 +64,7 @@ getfullhostname(void)
 
     if (gethostname(buf, RFC2181_MAXHOSTNAMELEN) < 0)
         return NULL;
-    /** \todo convert this to a xgetaddrinfo() call */
+    /** \todo convert this to a getaddrinfo() call */
     if ((hp = gethostbyname(buf)) != NULL)
         xstrncpy(buf, hp->h_name, RFC2181_MAXHOSTNAMELEN);
     return buf;
index ab8ac0f2185ab9050b7c7ff1958d1fa0347df634..f94ea52e7ef8541aa57c2854f3a13a796374226c 100644 (file)
@@ -77,9 +77,9 @@
 
 #ifndef HAVE_GETNAMEINFO
 
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
+#include "compat/inet_ntop.h"
+#include "compat/getaddrinfo.h"
+
 #if HAVE_STDIO_H
 #include <stdio.h>
 #endif
 #include <ws2tcpip.h>
 #endif
 
-#include "getaddrinfo.h"
-
-#if !HAVE_INET_NTOP
-#include "inet_ntop.h"
-#endif
-
 static const struct afd {
     int a_af;
     int a_addrlen;
@@ -330,7 +324,7 @@ numeric:
             }
 #endif
             default:
-                if (xinet_ntop(afd->a_af, addr, host,
+                if (inet_ntop(afd->a_af, addr, host,
                                hostlen) == NULL)
                     return EAI_SYSTEM;
                 break;
@@ -352,7 +346,7 @@ int flags;
     int numaddrlen;
     char numaddr[512];
 
-    if (xinet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
+    if (inet_ntop(AF_INET6, addr, numaddr, sizeof(numaddr)) == NULL)
         return EAI_SYSTEM;
 
     numaddrlen = strlen(numaddr);
index 41f8e3f68b123751fe8d33b087c3ef295427aaab..1a84a66a3da65714531bfbd707ac498d0653151f 100644 (file)
@@ -1,11 +1,9 @@
 #include "config.h"
+#include "compat/initgroups.h"
 
 #if HAVE_GRP_H
 #include <grp.h>
 #endif
-#if HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -18,9 +16,6 @@
 #if HAVE_LIMITS_H
 #include <limits.h>
 #endif
-#if !HAVE_INITGROUPS
-#include "initgroups.h"
-#endif
 
 int initgroups(const char *name, gid_t basegid)
 {
index 24ca56360325275ebf2285237e2c95255148e05e..ab93de9fc8224e6ba9eb9681ddae64c0faffe381 100644 (file)
@@ -57,6 +57,7 @@
  */
 
 #include "config.h"
+#include "compat/inet_pton.h"
 #include "util.h"
 
 #if HAVE_STDIO_H
@@ -263,7 +264,7 @@ main(int argc, char *argv[])
         ((struct sockaddr_in6 *)S)->sin6_family = AF_INET6;
         ((struct sockaddr_in6 *)S)->sin6_port = htons(atoi(argv[var+1]));
 
-        if ( ! xinet_pton(AF_INET6, argv[var], &((struct sockaddr_in6 *)S)->sin6_addr.s_addr) )
+        if ( ! inet_pton(AF_INET6, argv[var], &((struct sockaddr_in6 *)S)->sin6_addr.s_addr) )
             perror("listen address");
         return 1;
     }
@@ -278,7 +279,7 @@ else
     ((struct sockaddr_in *)S)->sin_family = AF_INET;
     ((struct sockaddr_in *)S)->sin_port = htons(atoi(argv[var+1]));
 
-    if ( ! xinet_pton(AF_INET, argv[var], &((struct sockaddr_in *)S)->sin_addr.s_addr) )
+    if ( ! inet_pton(AF_INET, argv[var], &((struct sockaddr_in *)S)->sin_addr.s_addr) )
         perror("listen address");
     return 1;
 }
@@ -294,10 +295,10 @@ while (fgets(input, 512, stdin))
     memset(buf, '\0', 512);
     sz = 512;
 
-    if (xinet_pton(AF_INET6, input, &junk6)) {
+    if (inet_pton(AF_INET6, input, &junk6)) {
         sid = rfc1035BuildPTRQuery6(junk6, buf, &sz);
         sidb=0;
-    } else if (xinet_pton(AF_INET, input, &junk4)) {
+    } else if (inet_pton(AF_INET, input, &junk4)) {
         sid = rfc1035BuildPTRQuery4(junk4, buf, &sz);
         sidb=0;
     } else {
index 8d7209116b9bf5cd566893741ae85a5fd3788e88..1e59172dfe169023543b1052956eef27d03c760c 100644 (file)
@@ -39,7 +39,8 @@
 #endif
 
 extern int sys_nerr;
-#if NEED_SYS_ERRLIST && !defined(_SQUID_NETBSD_)
+
+#if NEED_SYS_ERRLIST
 extern char *sys_errlist[];
 #endif
 
index 6335cbeda404beeaa8e8fdd9a00394cc5d04be2d..0e2739f682a10cda5b8bca71bff4a776fd31af19 100644 (file)
@@ -1,7 +1,3 @@
-/*
- * $Id$
- */
-
 /* Copyright (C) 2004 Free Software Foundation, Inc.
  * Written by Yoann Vandoorselaere <yoann@prelude-ids.org>
  *
  * USA.
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* Specification.  */
-#include "strsep.h"
+#include "config.h"
+#include "compat/strsep.h"
 
 #include <string.h>
 
 char *
-strsep (char **stringp, const char *delim)
+strsep(char **stringp, const char *delim)
 {
     char *start = *stringp;
     char *ptr;
index 50f705da9bd0275401ecffefff8ed4733297ad2f..666b0828d31fa2690efe95c667f4aac31dfd613b 100644 (file)
@@ -33,9 +33,9 @@
 
 /* modified for long long <mgd@swarm.org> 1999-08-12 */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
+#include "compat/strtoll.h"
+
 #if HAVE_CTYPE_H
 #include <ctype.h>
 #endif
@@ -43,9 +43,6 @@
 #include <errno.h>
 #endif
 
-/* Specification.  */
-#include "strtoll.h"
-
 
 #ifndef INT64_MIN
 /* Native 64 bit system without strtoll() */
index 0ff9f88e35bef14a2b378eb137318149f6d1e7b4..dff1c9896f6c19711cb323446258e80a8dca9c59 100644 (file)
@@ -1,7 +1,3 @@
-/*
- * $Id$
- */
-
 /* A reasonably functional tmpnam. */
 
 /* Originally by Tom Hageman, tom@basil.icce.rug.nl */
@@ -13,6 +9,7 @@
  */
 
 #include "config.h"
+#include "compat/tempnam.h"
 
 #if HAVE_LIBC_H
 #include <libc.h>
@@ -20,9 +17,6 @@
 #if HAVE_STDIO_H
 #include <stdio.h>
 #endif
-#if HAVE_TYPES_H
-#include <sys/types.h>
-#endif
 #if HAVE_LIMITS_H
 #include <limits.h>
 #endif
index 4ae9bfa53bc405986720b568fee867af31a18b34..c4b995b34989a8ab0694916fee46735295842107 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * $Id$
  *
  */
 
 #include "squid.h"
-#include "HttpHeader.h"
-#include "HttpHdrContRange.h"
 #include "acl/FilledChecklist.h"
+#include "compat/strtoll.h"
+#include "HttpHdrContRange.h"
+#include "HttpHeader.h"
 #include "MemBuf.h"
 
 static void httpHeaderPutStrvf(HttpHeader * hdr, http_hdr_type id, const char *fmt, va_list vargs);
index a20ba9efca1754d89f10a81c2939ef3d3ce33195..a69810cc05f49259ec90b1be7424d7bd2e3be8ad 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * $Id$
  *
@@ -33,6 +32,8 @@
  *
  */
 
+#include "config.h"
+#include "compat/strtoll.h"
 #include "Parsing.h"
 
 /*
index 581e4ba74dd5d7a167ac10cff7c557bf3e8ee943..40c04099b816f27fdd239a7a5d11efd72536d536 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
  * $Id$
  *
@@ -34,6 +33,7 @@
  */
 
 #include "squid.h"
+#include "compat/strtoll.h"
 #include "SwapDir.h"
 #include "StoreFileSystem.h"
 #include "ConfigOption.h"
index 982293be4421bfda2c49ddfec6113bbd3d909e4e..9a501d58d5d455f18b68985687e5aad113cb6ecd 100644 (file)
@@ -34,6 +34,7 @@
  */
 
 #include "squid.h"
+#include "compat/getaddrinfo.h"
 #include "acl/Ip.h"
 #include "acl/Checklist.h"
 #include "MemBuf.h"
@@ -405,7 +406,7 @@ acl_ip_data::FactoryParse(const char *t)
         addr2[0] = '\0';
     } else if (sscanf(t, "%s", addr1) == 1) {
         /*
-         * Note, must use plain xgetaddrinfo() here because at startup
+         * Note, must use plain getaddrinfo() here because at startup
          * ipcache hasn't been initialized
          * TODO: offload this to one of the IpAddress lookups.
          */
@@ -425,11 +426,11 @@ acl_ip_data::FactoryParse(const char *t)
         hints.ai_flags |= AI_V4MAPPED | AI_ALL;
 #endif
 
-        int errcode = xgetaddrinfo(addr1,NULL,&hints,&hp);
+        int errcode = getaddrinfo(addr1,NULL,&hints,&hp);
         if (hp == NULL) {
             debugs(28, 0, "aclIpParseIpData: Bad host/IP: '" << addr1 <<
                    "' in '" << t << "', flags=" << hints.ai_flags <<
-                   " : (" << errcode << ") " << xgai_strerror(errcode) );
+                   " : (" << errcode << ") " << gai_strerror(errcode) );
             self_destruct();
             return NULL;
         }
@@ -468,7 +469,7 @@ acl_ip_data::FactoryParse(const char *t)
             return NULL;
         }
 
-        xfreeaddrinfo(hp);
+        freeaddrinfo(hp);
 
         return q;
     }
index e3056f20fe9b3cabc9911acf08a204e838da73bd..85234fd4c4bb937de4965ff0848c56152b96067d 100644 (file)
  */
 
 #include "squid.h"
-#include "clientStream.h"
-#include "client_side_request.h"
-#include "auth/UserRequest.h"
-#include "HttpRequest.h"
-#include "ProtoPort.h"
 #include "acl/FilledChecklist.h"
 #include "acl/Gadgets.h"
-#include "client_side.h"
-#include "client_side_reply.h"
-#include "Store.h"
-#include "HttpReply.h"
-#include "MemObject.h"
-#include "ClientRequestContext.h"
-#include "SquidTime.h"
-#include "wordlist.h"
-#include "inet_pton.h"
-#include "fde.h"
-
 #if USE_ADAPTATION
 #include "adaptation/AccessCheck.h"
 #include "adaptation/Iterator.h"
 #if ICAP_CLIENT
 #include "adaptation/icap/History.h"
 #endif
-//static void adaptationAclCheckDoneWrapper(Adaptation::ServicePointer service, void *data);
 #endif
-
+#include "auth/UserRequest.h"
+#include "clientStream.h"
+#include "client_side.h"
+#include "client_side_reply.h"
+#include "client_side_request.h"
+#include "ClientRequestContext.h"
+#include "compat/inet_pton.h"
+#include "fde.h"
+#include "HttpReply.h"
+#include "HttpRequest.h"
+#include "MemObject.h"
+#include "ProtoPort.h"
+#include "Store.h"
+#include "SquidTime.h"
+#include "wordlist.h"
 
 
 #if LINGERING_CLOSE
index 2cf4ec5613c357675be6487863fd2095c0f66b6e..a5a40b2df758e7a101bd6a780aec918d3afb641d 100644 (file)
@@ -31,6 +31,9 @@
  */
 
 #include "config.h"
+#include "compat/inet_ntop.h"
+#include "compat/getaddrinfo.h"
+#include "compat/getnameinfo.h"
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -204,10 +207,10 @@ lookup(const char *buf)
     hints.ai_flags = AI_CANONNAME;
 
     for (;;) {
-        xfreeaddrinfo(AI);
+        freeaddrinfo(AI);
         AI = NULL;
 
-        if ( 0 == (res = xgetaddrinfo(buf,NULL,&hints,&AI)) )
+        if ( 0 == (res = getaddrinfo(buf,NULL,&hints,&AI)) )
             break;
 
         if (res != EAI_AGAIN)
@@ -255,11 +258,11 @@ lookup(const char *buf)
                 /* annoying inet_ntop breaks the nice code by requiring the in*_addr */
                 switch (aiptr->ai_family) {
                 case AF_INET:
-                    xinet_ntop(aiptr->ai_family, &((struct sockaddr_in*)aiptr->ai_addr)->sin_addr, ntoabuf, MAX_IPSTRLEN);
+                    inet_ntop(aiptr->ai_family, &((struct sockaddr_in*)aiptr->ai_addr)->sin_addr, ntoabuf, MAX_IPSTRLEN);
                     break;
 #if USE_IPV6
                 case AF_INET6:
-                    xinet_ntop(aiptr->ai_family, &((struct sockaddr_in6*)aiptr->ai_addr)->sin6_addr, ntoabuf, MAX_IPSTRLEN);
+                    inet_ntop(aiptr->ai_family, &((struct sockaddr_in6*)aiptr->ai_addr)->sin6_addr, ntoabuf, MAX_IPSTRLEN);
                     break;
 #endif
                 default:
@@ -281,7 +284,7 @@ lookup(const char *buf)
          */
         if (NULL != AI && NULL != AI->ai_addr) {
             for (;;) {
-                if ( 0 == (res = xgetnameinfo(AI->ai_addr, AI->ai_addrlen, ntoabuf, MAX_IPSTRLEN, NULL,0,0)) )
+                if ( 0 == (res = getnameinfo(AI->ai_addr, AI->ai_addrlen, ntoabuf, MAX_IPSTRLEN, NULL,0,0)) )
                     break;
 
                 if (res != EAI_AGAIN)
@@ -317,7 +320,7 @@ lookup(const char *buf)
         break;
 
     case EAI_FAIL:
-        printf("$fail DNS Domain/IP '%s' does not exist: %s.\n", buf, xgai_strerror(res));
+        printf("$fail DNS Domain/IP '%s' does not exist: %s.\n", buf, gai_strerror(res));
         break;
 
 #if defined(EAI_NODATA) || defined(EAI_NONAME)
@@ -328,14 +331,14 @@ lookup(const char *buf)
 #ifdef EAI_NONAME
     case EAI_NONAME:
 #endif
-        printf("$fail DNS Domain/IP '%s' exists without any FQDN/IPs: %s.\n", buf, xgai_strerror(res));
+        printf("$fail DNS Domain/IP '%s' exists without any FQDN/IPs: %s.\n", buf, gai_strerror(res));
         break;
 #endif
     default:
-        printf("$fail A system error occured looking up Domain/IP '%s': %s.\n", buf, xgai_strerror(res));
+        printf("$fail A system error occured looking up Domain/IP '%s': %s.\n", buf, gai_strerror(res));
     }
 
-    xfreeaddrinfo(AI);
+    freeaddrinfo(AI);
 }
 
 /**
index e11e6f04a8bc3426c01740b13671e80796c6e939..b7be5d1466461fd94b31ad673dfb7639625e62f1 100644 (file)
@@ -9,17 +9,12 @@
 
 #if USE_SQUID_EUI
 
+#include "compat/eui64_aton.h"
 #include "Debug.h"
 #include "eui/Eui64.h"
 #include "globals.h"
 #include "ip/IpAddress.h"
 
-#if HAVE_SYS_EUI64_H
-#include <sys/eui64.h>
-#else
-#include "eui64_aton.h"
-#endif
-
 bool
 Eui::Eui64::decode(const char *asc)
 {
index 612b8fcd712921bba5e8210d007a96acc2f99713..dd0057884dfd138d3639c2351ec01d40fe2cf57a 100644 (file)
  *
  */
 
-#include "event.h"
+#include "config.h"
+#include "compat/drand48.h"
 #include "CacheManager.h"
+#include "event.h"
 #include "Store.h"
 #include "SquidTime.h"
 
index 6d20ba8434786e36db7d56501e1b5ee4efebab09..2a3c8fbc5fb9dc99592fd6033cf12046c85cd7ca 100644 (file)
@@ -35,6 +35,7 @@
 #include "squid.h"
 #include "comm.h"
 #include "comm/ListenStateData.h"
+#include "compat/strtoll.h"
 #include "ConnectionDetail.h"
 #include "errorpage.h"
 #include "fde.h"
index 1aa2f047be326631e22599917ed8551a7cc2bad0..147aa161cf6a679a1bc0ee88c828001fe920f8e0 100644 (file)
  */
 
 #include "config.h"
+#include "compat/inet_ntop.h"
+#include "compat/getaddrinfo.h"
 #include "Debug.h"
 #include "ip/IpAddress.h"
 #include "util.h"
 
-
 #if HAVE_ASSERT_H
 #include <assert.h>
 #endif
@@ -477,11 +478,11 @@ bool IpAddress::LookupHostIP(const char *s, bool nodns)
     want.ai_family = AF_INET;
 #endif
 
-    if ( (err = xgetaddrinfo(s, NULL, &want, &res)) != 0) {
-        debugs(14,3, HERE << "Given Bad IP '" << s << "': " << xgai_strerror(err) );
-        /* free the memory xgetaddrinfo() dynamically allocated. */
+    if ( (err = getaddrinfo(s, NULL, &want, &res)) != 0) {
+        debugs(14,3, HERE << "Given Bad IP '" << s << "': " << gai_strerror(err) );
+        /* free the memory getaddrinfo() dynamically allocated. */
         if (res) {
-            xfreeaddrinfo(res);
+            freeaddrinfo(res);
             res = NULL;
         }
         return false;
@@ -495,8 +496,8 @@ bool IpAddress::LookupHostIP(const char *s, bool nodns)
     operator=(*res);
     SetPort(port);
 
-    /* free the memory xgetaddrinfo() dynamically allocated. */
-    xfreeaddrinfo(res);
+    /* free the memory getaddrinfo() dynamically allocated. */
+    freeaddrinfo(res);
 
     res = NULL;
 
@@ -973,16 +974,16 @@ char* IpAddress::NtoA(char* buf, const unsigned int blen, int force) const
 #if USE_IPV6
     if ( force == AF_INET6 || (force == AF_UNSPEC && IsIPv6()) ) {
 
-        xinet_ntop(AF_INET6, &m_SocketAddr.sin6_addr, buf, blen);
+        inet_ntop(AF_INET6, &m_SocketAddr.sin6_addr, buf, blen);
 
     } else  if ( force == AF_INET || (force == AF_UNSPEC && IsIPv4()) ) {
 
         struct in_addr tmp;
         GetInAddr(tmp);
-        xinet_ntop(AF_INET, &tmp, buf, blen);
+        inet_ntop(AF_INET, &tmp, buf, blen);
 #else
     if ( force == AF_UNSPEC || (force == AF_INET && IsIPv4()) ) {
-        xinet_ntop(AF_INET, &m_SocketAddr.sin_addr, buf, blen);
+        inet_ntop(AF_INET, &m_SocketAddr.sin_addr, buf, blen);
 #endif
     } else {
         debugs(14,0,"WARNING: Corrupt IP Address details OR required to display in unknown format (" <<
index d631b108c825fba54a060f338286044efaf027e6..2b43ae0f5729c147a83d4fe187985cd94835bf32 100644 (file)
 #ifndef _INC_IPADDRESS_H
 #define _INC_IPADDRESS_H
 
-#include "getaddrinfo.h"
-#include "getnameinfo.h"
-#include "inet_ntop.h"
-#include "inet_pton.h"
-
+#include "config.h"
 
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
index b86513b5bebcd8739b690acb2e0d579df29ab2b7..b4841c52ce50aedff678e6ea23a36d9309dec165 100644 (file)
@@ -1,4 +1,5 @@
 #include "config.h"
+#include "compat/getaddrinfo.h"
 #include "testIpAddress.h"
 #include "ip/IpAddress.h"
 
@@ -610,7 +611,7 @@ testIpAddress::testAddrInfo()
     IpAddress anIP = "127.0.0.1";
 
     /* assert this just to check that getaddrinfo is working properly */
-    CPPUNIT_ASSERT( xgetaddrinfo("127.0.0.1", NULL, &hints, &expect ) == 0 );
+    CPPUNIT_ASSERT( getaddrinfo("127.0.0.1", NULL, &hints, &expect ) == 0 );
 
     anIP.GetAddrInfo(ipval);
 
@@ -690,7 +691,7 @@ testIpAddress::testAddrInfo()
 
     CPPUNIT_ASSERT( memcmp( expect->ai_addr, ipval->ai_addr, expect->ai_addrlen ) == 0 );
 
-    xfreeaddrinfo(expect);
+    freeaddrinfo(expect);
 }
 
 void
index d27c7814424a17791f003216c80b3aa7bcd4f414..b5097ab3dcabe79f8e3794027745d0420a27d0a9 100644 (file)
  *
  */
 #include "squid.h"
-#include "comm.h"
-#include "cache_snmp.h"
 #include "acl/FilledChecklist.h"
+#include "cache_snmp.h"
+#include "comm.h"
+#include "compat/strsep.h"
 #include "ip/IpAddress.h"
 
 #define SNMP_REQUEST_SIZE 4096
index 09e1d3492405c63d6a7b6b56ad029cc7627e75f4..5701aa8f415cdb6c4ba3faedb2845f6e10af0300 100644 (file)
@@ -154,44 +154,21 @@ using namespace Squid;
 #endif
 
 #include "md5.h"
-
 #if USE_SSL
 #include "ssl_support.h"
 #endif
-
 #ifdef SQUID_SNMP
 #include "cache_snmp.h"
 #endif
-
 #include "hash.h"
 #include "rfc3596.h"
-
-
 #include "defines.h"
 #include "enums.h"
 #include "typedefs.h"
 #include "util.h"
 #include "profiling.h"
 #include "MemPool.h"
-
 #include "ip/IpAddress.h"
-
-#if !HAVE_TEMPNAM
-#include "tempnam.h"
-#endif
-
-#if !HAVE_STRSEP
-#include "strsep.h"
-#endif
-
-#if !HAVE_STRTOLL
-#include "strtoll.h"
-#endif
-
-#if !HAVE_INITGROUPS
-#include "initgroups.h"
-#endif
-
 #include "structs.h"
 #include "protos.h"
 #include "globals.h"
index 91c2110e8162c8547ffd69a20672ed0d450e9e4d..74ac708c9c6801a5ce784421adb1dd3df0d81e12 100644 (file)
  */
 
 #include "squid.h"
-#include "ProtoPort.h"
-#include "SwapDir.h"
+#include "compat/initgroups.h"
+#include "compat/getaddrinfo.h"
+#include "compat/getnameinfo.h"
+#include "compat/tempnam.h"
 #include "fde.h"
+#include "ip/IpIntercept.h"
 #include "MemBuf.h"
-#include "wordlist.h"
+#include "ProtoPort.h"
 #include "SquidMath.h"
 #include "SquidTime.h"
-#include "ip/IpIntercept.h"
+#include "SwapDir.h"
+#include "wordlist.h"
 
 #if HAVE_SYS_PRCTL_H
 #include <sys/prctl.h>
@@ -612,7 +616,7 @@ getMyHostname(void)
 
         sa.GetAddrInfo(AI);
         /* we are looking for a name. */
-        if (xgetnameinfo(AI->ai_addr, AI->ai_addrlen, host, SQUIDHOSTNAMELEN, NULL, 0, NI_NAMEREQD ) == 0) {
+        if (getnameinfo(AI->ai_addr, AI->ai_addrlen, host, SQUIDHOSTNAMELEN, NULL, 0, NI_NAMEREQD ) == 0) {
             /* DNS lookup successful */
             /* use the official name from DNS lookup */
             debugs(50, 4, "getMyHostname: resolved " << sa << " to '" << host << "'");
@@ -636,7 +640,7 @@ getMyHostname(void)
             memset(&hints, 0, sizeof(addrinfo));
             hints.ai_flags = AI_CANONNAME;
 
-            if (xgetaddrinfo(host, NULL, NULL, &AI) == 0) {
+            if (getaddrinfo(host, NULL, NULL, &AI) == 0) {
                 /* DNS lookup successful */
                 /* use the official name from DNS lookup */
                 debugs(50, 6, "getMyHostname: '" << host << "' has rDNS.");
@@ -644,14 +648,14 @@ getMyHostname(void)
 
                 /* AYJ: do we want to flag AI_ALL and cache the result anywhere. ie as our local host IPs? */
                 if (AI) {
-                    xfreeaddrinfo(AI);
+                    freeaddrinfo(AI);
                     AI = NULL;
                 }
 
                 return host;
             }
 
-            if (AI) xfreeaddrinfo(AI);
+            if (AI) freeaddrinfo(AI);
             debugs(50, 1, "WARNING: '" << host << "' rDNS test failed: " << xstrerror());
         }
     }
index 012be6dc77961a23bed434122781c096593baa1b..76b4940bf682c7821bf84fa23261097702377d2a 100644 (file)
 #if USE_WCCPv2
 
 #include "comm.h"
+#include "compat/strsep.h"
 #include "event.h"
+#include "ip/IpAddress.h"
 #include "Parsing.h"
 #include "Store.h"
 #include "SwapDir.h"
-#include "ip/IpAddress.h"
 
 #if HAVE_NETDB_H
 #include <netdb.h>
index fccd83cb0c764f08d730e4e392b4379d766497d4..7ca24bcd47823418941150fb203aef55246eb4b6 100644 (file)
@@ -1,36 +1,5 @@
-
 #include "config.h"
-
-/*
- * On some systems, FD_SETSIZE is set to something lower than the
- * actual number of files which can be opened.  IRIX is one case,
- * NetBSD is another.  So here we increase FD_SETSIZE to our
- * configure-discovered maximum *before* any system includes.
- */
-#define CHANGE_FD_SETSIZE 1
-
-/* Cannot increase FD_SETSIZE on Linux */
-#if defined(_SQUID_LINUX_)
-#undef CHANGE_FD_SETSIZE
-#define CHANGE_FD_SETSIZE 0
-#endif
-
-/* Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
- * to return EINVAL. */
-/* Marian Durkovic <marian@svf.stuba.sk> */
-/* Peter Wemm <peter@spinner.DIALix.COM> */
-#if defined(_SQUID_FREEBSD_)
-#include <osreldate.h>
-#if __FreeBSD_version < 220000
-#undef CHANGE_FD_SETSIZE
-#define CHANGE_FD_SETSIZE 0
-#endif
-#endif
-
-/* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
-#if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
-#define FD_SETSIZE SQUID_MAXFD
-#endif
+#include "compat/getaddrinfo.h"
 
 #if HAVE_UNISTD_H
 #include <unistd.h>
@@ -81,8 +50,6 @@
 #include <sys/stat.h>
 #endif
 
-#include "getaddrinfo.h"
-
 #define PROXY_PORT "3128"
 #define PROXY_ADDR "127.0.0.1"
 #define MAX_FDS 1024
@@ -171,22 +138,19 @@ open_http_socket(void)
     hints.ai_family = AF_UNSPEC;
     hints.ai_socktype = SOCK_STREAM;
 
-    xgetaddrinfo(proxy_addr, proxy_port, &hints, AI);
+    getaddrinfo(proxy_addr, proxy_port, &hints, AI);
 
     if ((s = socket(AI->ai_family, AI->ai_socktype, AI->ai_protocol)) < 0) {
         perror("socket");
-        xfreeaddrinfo(AI);
-        return -1;
+       s = -1;
     }
-
-    if (connect(s, AI->ai_addr, AI->ai_addrlen) < 0) {
+    else if (connect(s, AI->ai_addr, AI->ai_addrlen) < 0) {
         close(s);
         perror("connect");
-        xfreeaddrinfo(AI);
-        return -1;
+        s = -1;
     }
 
-    xfreeaddrinfo(AI);
+    freeaddrinfo(AI);
     return s;
 }
 
index 0e4640dcfaef3db0d7e974ec7b86bbeb3b0dc483..98a600b94ad0de2c30dfa2dc0d205306b6faa4c6 100644 (file)
@@ -31,6 +31,7 @@
  */
 
 #include "config.h"
+#include "compat/tempnam.h"
 #include "rfc1738.h"
 
 #if HAVE_UNISTD_H