]> sjero.net Git - wget/blobdiff - src/connect.c
[svn] Define the IF_DEBUG macro.
[wget] / src / connect.c
index 16b6de6c3412c0ea8abbd7e6b145d35e3174cfef..69a2e5e6ab9a1f3fe5b071933f04de25efaec559 100644 (file)
@@ -31,7 +31,6 @@ so, delete this exception statement from your version.  */
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -47,11 +46,7 @@ so, delete this exception statement from your version.  */
 #endif /* not WINDOWS */
 
 #include <errno.h>
-#ifdef HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-#endif /* HAVE_STRING_H */
+#include <string.h>
 #ifdef HAVE_SYS_SELECT_H
 # include <sys/select.h>
 #endif /* HAVE_SYS_SELECT_H */
@@ -62,10 +57,6 @@ so, delete this exception statement from your version.  */
 #include "connect.h"
 #include "hash.h"
 
-#ifndef errno
-extern int errno;
-#endif
-
 /* Define sockaddr_storage where unavailable (presumably on IPv4-only
    hosts).  */
 
@@ -287,10 +278,9 @@ connect_to_ip (const ip_address *ip, int port, const char *print)
     int on = 1;
     /* In case of error, we will go on anyway... */
     int err = setsockopt (sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof (on));
-#ifdef ENABLE_DEBUG
-    if (err < 0) 
-      DEBUGP (("Failed setting IPV6_V6ONLY: %s", strerror (errno)));
-#endif
+    IF_DEBUG
+      if (err < 0) 
+       DEBUGP (("Failed setting IPV6_V6ONLY: %s", strerror (errno)));
   }
 #endif
 
@@ -620,7 +610,6 @@ retryable_socket_connect_error (int err)
 int
 select_fd (int fd, double maxtime, int wait_for)
 {
-#ifdef HAVE_SELECT
   fd_set fdset;
   fd_set *rd = NULL, *wr = NULL;
   struct timeval tmout;
@@ -641,23 +630,11 @@ select_fd (int fd, double maxtime, int wait_for)
   while (result < 0 && errno == EINTR);
 
   return result;
-
-#else  /* not HAVE_SELECT */
-
-  /* If select() unavailable, just return 1.  In most usages in Wget,
-     this is the appropriate response -- "if we can't poll, go ahead
-     with the blocking operation".  If a specific part of code needs
-     different behavior, it can use #ifdef HAVE_SELECT to test whether
-     polling really occurs.  */
-  return 1;
-
-#endif /* not HAVE_SELECT */
 }
 
 int
 test_socket_open (int sock)
 {
-#ifdef HAVE_SELECT
   fd_set check_set;
   struct timeval to;
 
@@ -679,10 +656,6 @@ test_socket_open (int sock)
     }
   else
     return 0;
-#else
-  /* Without select, it's hard to know for sure. */
-  return 1;
-#endif
 }
 \f
 /* Basic socket operations, mostly EINTR wrappers.  */