mirror of
https://github.com/moparisthebest/wget
synced 2024-07-03 16:38:41 -04:00
imported patch windows
This commit is contained in:
parent
a40256c1a9
commit
663b1b3367
@ -1,3 +1,9 @@
|
|||||||
|
2009-09-22 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
|
* configure.ac: Added "sleep" and "symlink" to AC_CHECK_FUNCS,
|
||||||
|
removing the hard-coded definition of HAVE_SYMLINK. When running
|
||||||
|
on MinGW, compile mswindows.c, and link against libwsock32.
|
||||||
|
|
||||||
2009-09-21 Micah Cowan <micah@cowan.name>
|
2009-09-21 Micah Cowan <micah@cowan.name>
|
||||||
|
|
||||||
* vms/VMS-WGET.COM: "the the" -> "the".
|
* vms/VMS-WGET.COM: "the the" -> "the".
|
||||||
|
10
configure.ac
10
configure.ac
@ -202,6 +202,7 @@ AC_FUNC_MMAP
|
|||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
AC_CHECK_FUNCS(strptime timegm snprintf vsnprintf vasprintf drand48)
|
AC_CHECK_FUNCS(strptime timegm snprintf vsnprintf vasprintf drand48)
|
||||||
AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc)
|
AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc)
|
||||||
|
AC_CHECK_FUNCS(sleep symlink)
|
||||||
|
|
||||||
if test x"$ENABLE_OPIE" = xyes; then
|
if test x"$ENABLE_OPIE" = xyes; then
|
||||||
AC_LIBOBJ([ftp-opie])
|
AC_LIBOBJ([ftp-opie])
|
||||||
@ -215,7 +216,6 @@ AC_DEFINE([HAVE_STRCASECMP], 1, [Define to 1 if you have the `strcasecmp' functi
|
|||||||
AC_DEFINE([HAVE_STRNCASECMP], 1, [Define to 1 if you have the `strncasecmp' function.])
|
AC_DEFINE([HAVE_STRNCASECMP], 1, [Define to 1 if you have the `strncasecmp' function.])
|
||||||
AC_DEFINE([HAVE_STRDUP], 1, [Define to 1 if you have the `strdup' function.])
|
AC_DEFINE([HAVE_STRDUP], 1, [Define to 1 if you have the `strdup' function.])
|
||||||
AC_DEFINE([HAVE_ISATTY], 1, [Define to 1 if you have the `isatty' function.])
|
AC_DEFINE([HAVE_ISATTY], 1, [Define to 1 if you have the `isatty' function.])
|
||||||
AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the `symlink' function.])
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Call Wget-specific macros defined in aclocal.
|
dnl Call Wget-specific macros defined in aclocal.
|
||||||
@ -227,6 +227,14 @@ WGET_NANOSLEEP
|
|||||||
WGET_POSIX_CLOCK
|
WGET_POSIX_CLOCK
|
||||||
WGET_NSL_SOCKET
|
WGET_NSL_SOCKET
|
||||||
|
|
||||||
|
dnl Deal with specific hosts
|
||||||
|
case $host_os in
|
||||||
|
*mingw32* )
|
||||||
|
AC_SUBST(W32LIBS, '-lwsock32')
|
||||||
|
AC_LIBOBJ([mswindows])
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
dnl
|
dnl
|
||||||
|
@ -7,6 +7,28 @@
|
|||||||
ensures we find the repository, even if the build directory is
|
ensures we find the repository, even if the build directory is
|
||||||
outside the source directory.
|
outside the source directory.
|
||||||
|
|
||||||
|
* wget.h: define WINDOWS if _WIN32 or __WIN32__ is defined, but
|
||||||
|
not __CYGWIN__.
|
||||||
|
|
||||||
|
* mswindows.c (xsleep): Check for availability of the sleep
|
||||||
|
function, in addition to the usleep function.
|
||||||
|
(get_winsock_error, windows_strerror): Removed (gnulib already
|
||||||
|
supplies this functionality).
|
||||||
|
|
||||||
|
* mswindows.h [NEED_GAI_STRERROR]: define gai_strerror
|
||||||
|
to (gnulib's) strerror, rather than windows_strerror. Removed
|
||||||
|
error macro definitions provided by gnulib.
|
||||||
|
(windows_strerror): Removed (gnulib already supplies this
|
||||||
|
functionality).
|
||||||
|
|
||||||
|
* host.c: Don't declare h_errno when building on Windows.
|
||||||
|
|
||||||
|
* Makefile.am (LIBS): Added @W32LIBS@.
|
||||||
|
(EXTRA_wget_SOURCES): Removed (it's in LIBOBJ now).
|
||||||
|
(version.c): Removed dependency on $(LDADD), since it may include
|
||||||
|
dependencies that are not part of the Wget sources (-lwsock32, for
|
||||||
|
instance).
|
||||||
|
|
||||||
* openssl.c (ssl_check_certificate): Avoid reusing the same buffer
|
* openssl.c (ssl_check_certificate): Avoid reusing the same buffer
|
||||||
space for successive quoted arguments. Thanks to Steven Schweda
|
space for successive quoted arguments. Thanks to Steven Schweda
|
||||||
for pointing out the problem.
|
for pointing out the problem.
|
||||||
|
@ -36,7 +36,7 @@ endif
|
|||||||
|
|
||||||
# The following line is losing on some versions of make!
|
# The following line is losing on some versions of make!
|
||||||
DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
|
DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
|
||||||
LIBS = @LIBSSL@ @LIBGNUTLS@ @LIBICONV@ @LIBINTL@ @LIBS@
|
LIBS = @LIBSSL@ @LIBGNUTLS@ @LIBICONV@ @LIBINTL@ @W32LIBS@ @LIBS@
|
||||||
|
|
||||||
bin_PROGRAMS = wget
|
bin_PROGRAMS = wget
|
||||||
wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \
|
wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \
|
||||||
@ -52,9 +52,10 @@ wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \
|
|||||||
spider.h ssl.h sysdep.h url.h utils.h wget.h iri.h \
|
spider.h ssl.h sysdep.h url.h utils.h wget.h iri.h \
|
||||||
exits.h gettext.h
|
exits.h gettext.h
|
||||||
nodist_wget_SOURCES = version.c
|
nodist_wget_SOURCES = version.c
|
||||||
EXTRA_wget_SOURCES = mswindows.c iri.c
|
EXTRA_wget_SOURCES = iri.c
|
||||||
LDADD = $(LIBOBJS) ../lib/libgnu.a @MD5_LDADD@
|
LDADD = $(LIBOBJS) ../lib/libgnu.a @MD5_LDADD@
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/lib @MD5_CPPFLAGS@
|
AM_CPPFLAGS = -I$(top_srcdir)/lib @MD5_CPPFLAGS@
|
||||||
|
MD5_LDADD = @MD5_LDADD@
|
||||||
|
|
||||||
../lib/libgnu.a:
|
../lib/libgnu.a:
|
||||||
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
||||||
@ -67,8 +68,8 @@ build_info.c: $(srcdir)/Makefile.am $(srcdir)/build_info.c.in
|
|||||||
$(srcdir)/build_info.c.in > $@
|
$(srcdir)/build_info.c.in > $@
|
||||||
|
|
||||||
ESCAPEQUOTE = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
|
ESCAPEQUOTE = sed -e 's/[\\"]/\\&/g' -e 's/\\"/"/' -e 's/\\";$$/";/'
|
||||||
version.c: $(wget_SOURCES) $(LDADD) $(srcdir)/Makefile.am \
|
version.c: $(wget_SOURCES) ../lib/libgnu.a $(MD5_LDADD) \
|
||||||
$(top_srcdir)/configure.ac
|
$(srcdir)/Makefile.am $(top_srcdir)/configure.ac
|
||||||
echo '/* version.c */' > $@
|
echo '/* version.c */' > $@
|
||||||
echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@
|
echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@
|
||||||
echo '' >> $@
|
echo '' >> $@
|
||||||
|
@ -63,7 +63,7 @@ as that of the covered work. */
|
|||||||
# define NO_ADDRESS NO_DATA
|
# define NO_ADDRESS NO_DATA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_DECL_H_ERRNO
|
#if !HAVE_DECL_H_ERRNO && !defined(WINDOWS)
|
||||||
extern int h_errno;
|
extern int h_errno;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ void log_request_redirect_output (const char *);
|
|||||||
void
|
void
|
||||||
xsleep (double seconds)
|
xsleep (double seconds)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_USLEEP
|
#if defined(HAVE_USLEEP) && defined(HAVE_SLEEP)
|
||||||
if (seconds > 1000)
|
if (seconds > 1000)
|
||||||
{
|
{
|
||||||
/* Explained in utils.c. */
|
/* Explained in utils.c. */
|
||||||
@ -603,91 +603,6 @@ WRAP (setsockopt, (int s, int level, int opt, const void *val, int len),
|
|||||||
(s, level, opt, val, len))
|
(s, level, opt, val, len))
|
||||||
WRAP (closesocket, (int s), (s))
|
WRAP (closesocket, (int s), (s))
|
||||||
|
|
||||||
/* Return the text of the error message for Winsock error WSERR. */
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_winsock_error (int wserr)
|
|
||||||
{
|
|
||||||
switch (wserr) {
|
|
||||||
case WSAEINTR: return "Interrupted system call";
|
|
||||||
case WSAEBADF: return "Bad file number";
|
|
||||||
case WSAEACCES: return "Permission denied";
|
|
||||||
case WSAEFAULT: return "Bad address";
|
|
||||||
case WSAEINVAL: return "Invalid argument";
|
|
||||||
case WSAEMFILE: return "Too many open files";
|
|
||||||
case WSAEWOULDBLOCK: return "Resource temporarily unavailable";
|
|
||||||
case WSAEINPROGRESS: return "Operation now in progress";
|
|
||||||
case WSAEALREADY: return "Operation already in progress";
|
|
||||||
case WSAENOTSOCK: return "Socket operation on nonsocket";
|
|
||||||
case WSAEDESTADDRREQ: return "Destination address required";
|
|
||||||
case WSAEMSGSIZE: return "Message too long";
|
|
||||||
case WSAEPROTOTYPE: return "Protocol wrong type for socket";
|
|
||||||
case WSAENOPROTOOPT: return "Bad protocol option";
|
|
||||||
case WSAEPROTONOSUPPORT: return "Protocol not supported";
|
|
||||||
case WSAESOCKTNOSUPPORT: return "Socket type not supported";
|
|
||||||
case WSAEOPNOTSUPP: return "Operation not supported";
|
|
||||||
case WSAEPFNOSUPPORT: return "Protocol family not supported";
|
|
||||||
case WSAEAFNOSUPPORT: return "Address family not supported by protocol family";
|
|
||||||
case WSAEADDRINUSE: return "Address already in use";
|
|
||||||
case WSAEADDRNOTAVAIL: return "Cannot assign requested address";
|
|
||||||
case WSAENETDOWN: return "Network is down";
|
|
||||||
case WSAENETUNREACH: return "Network is unreachable";
|
|
||||||
case WSAENETRESET: return "Network dropped connection on reset";
|
|
||||||
case WSAECONNABORTED: return "Software caused connection abort";
|
|
||||||
case WSAECONNRESET: return "Connection reset by peer";
|
|
||||||
case WSAENOBUFS: return "No buffer space available";
|
|
||||||
case WSAEISCONN: return "Socket is already connected";
|
|
||||||
case WSAENOTCONN: return "Socket is not connected";
|
|
||||||
case WSAESHUTDOWN: return "Cannot send after socket shutdown";
|
|
||||||
case WSAETOOMANYREFS: return "Too many references";
|
|
||||||
case WSAETIMEDOUT: return "Connection timed out";
|
|
||||||
case WSAECONNREFUSED: return "Connection refused";
|
|
||||||
case WSAELOOP: return "Too many levels of symbolic links";
|
|
||||||
case WSAENAMETOOLONG: return "File name too long";
|
|
||||||
case WSAEHOSTDOWN: return "Host is down";
|
|
||||||
case WSAEHOSTUNREACH: return "No route to host";
|
|
||||||
case WSAENOTEMPTY: return "Not empty";
|
|
||||||
case WSAEPROCLIM: return "Too many processes";
|
|
||||||
case WSAEUSERS: return "Too many users";
|
|
||||||
case WSAEDQUOT: return "Bad quota";
|
|
||||||
case WSAESTALE: return "Something is stale";
|
|
||||||
case WSAEREMOTE: return "Remote error";
|
|
||||||
case WSAEDISCON: return "Disconnected";
|
|
||||||
|
|
||||||
/* Extended Winsock errors */
|
|
||||||
case WSASYSNOTREADY: return "Winsock library is not ready";
|
|
||||||
case WSANOTINITIALISED: return "Winsock library not initalised";
|
|
||||||
case WSAVERNOTSUPPORTED: return "Winsock version not supported";
|
|
||||||
|
|
||||||
case WSAHOST_NOT_FOUND: return "Host not found";
|
|
||||||
case WSATRY_AGAIN: return "Host not found, try again";
|
|
||||||
case WSANO_RECOVERY: return "Unrecoverable error in call to nameserver";
|
|
||||||
case WSANO_DATA: return "No data record of requested type";
|
|
||||||
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the error message corresponding to ERR. This is different
|
|
||||||
from Windows libc strerror() in that it handles Winsock errors
|
|
||||||
correctly. */
|
|
||||||
|
|
||||||
const char *
|
|
||||||
windows_strerror (int err)
|
|
||||||
{
|
|
||||||
const char *p;
|
|
||||||
if (err >= 0 && err < sys_nerr)
|
|
||||||
return strerror (err);
|
|
||||||
else if ((p = get_winsock_error (err)) != NULL)
|
|
||||||
return p;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
static char buf[32];
|
|
||||||
snprintf (buf, sizeof (buf), "Unknown error %d (%#x)", err, err);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_IPV6
|
#ifdef ENABLE_IPV6
|
||||||
/* An inet_ntop implementation that uses WSAAddressToString.
|
/* An inet_ntop implementation that uses WSAAddressToString.
|
||||||
|
@ -125,7 +125,7 @@ const char *inet_ntop (int, const void *, char *, socklen_t);
|
|||||||
|
|
||||||
#ifdef NEED_GAI_STRERROR
|
#ifdef NEED_GAI_STRERROR
|
||||||
# undef gai_strerror
|
# undef gai_strerror
|
||||||
# define gai_strerror windows_strerror
|
# define gai_strerror strerror
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef INHIBIT_WRAP
|
#ifndef INHIBIT_WRAP
|
||||||
@ -160,51 +160,6 @@ int wrapped_getpeername (int, struct sockaddr *, int *);
|
|||||||
int wrapped_setsockopt (int, int, int, const void *, int);
|
int wrapped_setsockopt (int, int, int, const void *, int);
|
||||||
int wrapped_closesocket (int);
|
int wrapped_closesocket (int);
|
||||||
|
|
||||||
/* Finally, provide a private version of strerror that does the
|
|
||||||
right thing with Winsock errors. */
|
|
||||||
#ifndef INHIBIT_WRAP
|
|
||||||
# define strerror windows_strerror
|
|
||||||
#endif
|
|
||||||
const char *windows_strerror (int);
|
|
||||||
|
|
||||||
/* Declarations of various socket errors: */
|
|
||||||
|
|
||||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
|
||||||
#define EINPROGRESS WSAEINPROGRESS
|
|
||||||
#define EALREADY WSAEALREADY
|
|
||||||
#define ENOTSOCK WSAENOTSOCK
|
|
||||||
#define EDESTADDRREQ WSAEDESTADDRREQ
|
|
||||||
#define EMSGSIZE WSAEMSGSIZE
|
|
||||||
#define EPROTOTYPE WSAEPROTOTYPE
|
|
||||||
#define ENOPROTOOPT WSAENOPROTOOPT
|
|
||||||
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
|
|
||||||
#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
|
|
||||||
#define EOPNOTSUPP WSAEOPNOTSUPP
|
|
||||||
#define EPFNOSUPPORT WSAEPFNOSUPPORT
|
|
||||||
#define EAFNOSUPPORT WSAEAFNOSUPPORT
|
|
||||||
#define EADDRINUSE WSAEADDRINUSE
|
|
||||||
#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
|
|
||||||
#define ENETDOWN WSAENETDOWN
|
|
||||||
#define ENETUNREACH WSAENETUNREACH
|
|
||||||
#define ENETRESET WSAENETRESET
|
|
||||||
#define ECONNABORTED WSAECONNABORTED
|
|
||||||
#define ECONNRESET WSAECONNRESET
|
|
||||||
#define ENOBUFS WSAENOBUFS
|
|
||||||
#define EISCONN WSAEISCONN
|
|
||||||
#define ENOTCONN WSAENOTCONN
|
|
||||||
#define ESHUTDOWN WSAESHUTDOWN
|
|
||||||
#define ETOOMANYREFS WSAETOOMANYREFS
|
|
||||||
#define ETIMEDOUT WSAETIMEDOUT
|
|
||||||
#define ECONNREFUSED WSAECONNREFUSED
|
|
||||||
#define ELOOP WSAELOOP
|
|
||||||
#define EHOSTDOWN WSAEHOSTDOWN
|
|
||||||
#define EHOSTUNREACH WSAEHOSTUNREACH
|
|
||||||
#define EPROCLIM WSAEPROCLIM
|
|
||||||
#define EUSERS WSAEUSERS
|
|
||||||
#define EDQUOT WSAEDQUOT
|
|
||||||
#define ESTALE WSAESTALE
|
|
||||||
#define EREMOTE WSAEREMOTE
|
|
||||||
|
|
||||||
/* Public functions. */
|
/* Public functions. */
|
||||||
|
|
||||||
void ws_startup (void);
|
void ws_startup (void);
|
||||||
|
@ -38,6 +38,10 @@ as that of the covered work. */
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
|
||||||
|
# define WINDOWS
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Include these, so random files need not include them. */
|
/* Include these, so random files need not include them. */
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user