]> sjero.net Git - wget/blobdiff - src/host.c
[svn] Define the IF_DEBUG macro.
[wget] / src / host.c
index f1fb64e7d3f7d040371711f15ca2f0942d9be873..fccc0d6dc19f704a7fa3cd337cfe2bbb7e2cf326 100644 (file)
@@ -35,13 +35,8 @@ so, delete this exception statement from your version.  */
 
 #include <stdio.h>
 #include <stdlib.h>
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif
+#include <string.h>
 #include <assert.h>
-#include <sys/types.h>
 
 #ifndef WINDOWS
 # include <sys/socket.h>
@@ -64,16 +59,6 @@ so, delete this exception statement from your version.  */
 #include "hash.h"
 #include "connect.h"           /* for socket_has_inet6 */
 
-#ifndef errno
-extern int errno;
-#endif
-
-#ifndef h_errno
-# ifndef __CYGWIN__
-extern int h_errno;
-# endif
-#endif
-
 #ifndef NO_ADDRESS
 # define NO_ADDRESS NO_DATA
 #endif
@@ -637,8 +622,7 @@ cache_store (const char *host, struct address_list *al)
   ++al->refcount;
   hash_table_put (host_name_addresses_map, xstrdup_lower (host), al);
 
-#ifdef ENABLE_DEBUG
-  if (opt.debug)
+  IF_DEBUG
     {
       int i;
       debug_logprintf ("Caching %s =>", host);
@@ -646,7 +630,6 @@ cache_store (const char *host, struct address_list *al)
        debug_logprintf (" %s", pretty_print_address (al->addresses + i));
       debug_logprintf ("\n");
     }
-#endif
 }
 
 /* Remove HOST from the DNS cache.  Does nothing is HOST is not in
@@ -767,17 +750,11 @@ lookup_host (const char *host, int flags)
     else if (opt.ipv6_only)
       hints.ai_family = AF_INET6;
     else
-      {
+      /* We tried using AI_ADDRCONFIG, but removed it because: it
+        misinterprets IPv6 loopbacks, it is broken on AIX 5.1, and
+        it's unneeded since we sort the addresses anyway.  */
        hints.ai_family = AF_UNSPEC;
-#ifdef AI_ADDRCONFIG
-       hints.ai_flags |= AI_ADDRCONFIG;
-#else
-       /* On systems without AI_ADDRCONFIG, emulate it by manually
-          checking whether the system supports IPv6 sockets.  */
-       if (!socket_has_inet6 ())
-         hints.ai_family = AF_INET;
-#endif
-      }
+
     if (flags & LH_BIND)
       hints.ai_flags |= AI_PASSIVE;