#include <stdio.h>
#include <stdlib.h>
-#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#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 */
#include "connect.h"
#include "hash.h"
-#ifndef errno
-extern int errno;
-#endif
-
/* Define sockaddr_storage where unavailable (presumably on IPv4-only
hosts). */
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;
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;
}
else
return 0;
-#else
- /* Without select, it's hard to know for sure. */
- return 1;
-#endif
}
\f
/* Basic socket operations, mostly EINTR wrappers. */