From 9c1c7f27cdbccbf838648253144f394f94513655 Mon Sep 17 00:00:00 2001 From: hniksic Date: Thu, 29 Nov 2001 06:15:11 -0800 Subject: [PATCH] [svn] Windows fixes by Herold Heiko. --- src/ChangeLog | 8 ++++++++ src/cmpt.c | 8 ++++++-- src/mswindows.c | 17 +++++++++++++++++ src/mswindows.h | 7 +++++++ windows/Makefile.src | 8 ++++---- windows/Makefile.src.bor | 1 + windows/config.h.bor | 4 ++++ windows/config.h.ms | 3 +++ 8 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 94e912c2..fdb0ec9d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2001-01-23 Herold Heiko + + * config.h.ms, mswindows.h: defined HAVE_ISATTY, use _isatty for + MS VC; somebody with Borland compiler please check and provide + patch if possible; + + * cmpt.c: provided a usleep emulation. + 2001-11-29 Hrvoje Niksic * host.c (address_list_new): Initialize al->faulty. diff --git a/src/cmpt.c b/src/cmpt.c index 7a7add09..6fb7fc04 100644 --- a/src/cmpt.c +++ b/src/cmpt.c @@ -1209,8 +1209,10 @@ strptime (buf, format, tm) #ifndef HAVE_USLEEP -/* A simple usleep implementation based on select(). This will - probably not work on Windows. */ +#ifndef WINDOWS + +/* A simple usleep implementation based on select(). For Unix and + Unix-like systems. */ int usleep (unsigned long usec) @@ -1221,4 +1223,6 @@ usleep (unsigned long usec) select (0, NULL, NULL, NULL, &tm); return 0; } + +#endif /* not WINDOWS */ #endif /* not HAVE_USLEEP */ diff --git a/src/mswindows.c b/src/mswindows.c index 178b9231..6353cc28 100644 --- a/src/mswindows.c +++ b/src/mswindows.c @@ -42,12 +42,29 @@ static int windows_nt_p; /* Emulation of Unix sleep. */ + unsigned int sleep (unsigned seconds) { return SleepEx (1000 * seconds, TRUE) ? 0U : 1000 * seconds; } +/* Emulation of Unix usleep(). This has a granularity of + milliseconds, but that's ok because: + + a) Wget is only using it with milliseconds; + + b) You can't rely on usleep's granularity anyway. If a caller + expects usleep to respect every microsecond, he's in for a + surprise. */ + +int +usleep (unsigned long usec) +{ + SleepEx (usec / 1000, TRUE); + return 0; +} + static char * read_registry (HKEY hkey, char *subkey, char *valuename, char *buf, int *len) { diff --git a/src/mswindows.h b/src/mswindows.h index 3c4a76b0..fb96317b 100644 --- a/src/mswindows.h +++ b/src/mswindows.h @@ -48,6 +48,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ # define stat _stat #endif +#ifdef HAVE_ISATTY +/* Microsoft VC supports _isatty; Borland ? */ +#ifdef _MSC_VER +# define isatty _isatty +#endif +#endif + #define REALCLOSE(x) closesocket (x) /* read & write don't work with sockets on Windows 95. */ diff --git a/windows/Makefile.src b/windows/Makefile.src index bac24096..35c7c847 100644 --- a/windows/Makefile.src +++ b/windows/Makefile.src @@ -54,13 +54,13 @@ RM = del SRC = cmpt.c safe-ctype.c connect.c host.c http.c netrc.c ftp-basic.c ftp.c \ ftp-ls.c ftp-opie.c getopt.c hash.c headers.c html-parse.c html-url.c \ - retr.c recur.c res.c url.c cookies.c init.c utils.c main.c version.c \ - mswindows.c fnmatch.c gnu-md5.c rbuf.c log.c $(SSLSRC) + progress.c retr.c recur.c res.c url.c cookies.c init.c utils.c main.c \ + version.c mswindows.c fnmatch.c gnu-md5.c rbuf.c log.c $(SSLSRC) OBJ = cmpt$o safe-ctype$o connect$o host$o http$o netrc$o ftp-basic$o ftp$o \ ftp-ls$o ftp-opie$o getopt$o hash$o headers$o html-parse$o html-url$o \ - retr$o recur$o res$o url$o cookies$o init$o utils$o main$o version$o \ - mswindows$o fnmatch$o gnu-md5$o rbuf$o log$o $(SSLOBJ) + progress$o retr$o recur$o res$o url$o cookies$o init$o utils$o main$o \ + version$o mswindows$o fnmatch$o gnu-md5$o rbuf$o log$o $(SSLOBJ) .SUFFIXES: .c .obj diff --git a/windows/Makefile.src.bor b/windows/Makefile.src.bor index b3b2818a..9608c30d 100644 --- a/windows/Makefile.src.bor +++ b/windows/Makefile.src.bor @@ -28,6 +28,7 @@ retr.obj+ res.obj+ recur.obj+ rbuf.obj+ +progress.obj+ netrc.obj+ mswindows.obj+ gnu-md5.obj+ diff --git a/windows/config.h.bor b/windows/config.h.bor index c718cf67..44491a9d 100644 --- a/windows/config.h.bor +++ b/windows/config.h.bor @@ -176,4 +176,8 @@ char *alloca (); /* Define if we're using builtin (GNU) md5.c. */ #define HAVE_BUILTIN_MD5 1 +/* Define if you have the isatty function. */ +#undef HAVE_ISATTY + + #endif /* CONFIG_H */ diff --git a/windows/config.h.ms b/windows/config.h.ms index 6d747110..5078bd67 100644 --- a/windows/config.h.ms +++ b/windows/config.h.ms @@ -186,5 +186,8 @@ char *alloca (); #define inline __inline #define ftruncate chsize +/* Define if you have the isatty function. */ +#define HAVE_ISATTY 1 + #endif /* CONFIG_H */ -- 2.39.2