1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Fix for Borland's broken (on Win9X) `utime' function.

Submitted by Ian Abbott in <3CB33A8E.15259.1E52AF@localhost>.
(Based on original patch by Chin-yuan Kuo in
<20020321015049.16722.qmail@web16202.mail.tpe.yahoo.com>.)
This commit is contained in:
abbotti 2002-04-09 11:29:54 -07:00
parent 07d72c3cd3
commit c3c1c24f5c
4 changed files with 58 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2002-04-09 Ian Abbott <abbotti@mev.co.uk>
* windows/config.h.bor: define `HACK_BCC_UTIME_BUG'. Define `utime'
as `borland_utime' if `HACK_BCC_UTIME_BUG' is defined.
2002-03-26 Ian Abbott <abbotti@mev.co.uk> 2002-03-26 Ian Abbott <abbotti@mev.co.uk>
* windows/wget.dep: Updated several dependencies for object files. * windows/wget.dep: Updated several dependencies for object files.

View File

@ -1,3 +1,10 @@
2002-04-09 Ian Abbott <abbotti@mev.co.uk>
* mswindows.c (borland_utime): New function conditionally defined
when `HACK_BCC_UTIME_BUG' is defined. A reimplementation of
`utime()' as Borland's `utime()' function is broken on Windows 9x
systems. (Original patch by Chin-yuan Kuo <sr1111111@yahoo.com.tw>.)
2002-04-08 Hrvoje Niksic <hniksic@arsdigita.com> 2002-04-08 Hrvoje Niksic <hniksic@arsdigita.com>
* ftp.c (ftp_loop): Propagate the result of ftp_retrieve_glob. * ftp.c (ftp_loop): Propagate the result of ftp_retrieve_glob.

View File

@ -28,6 +28,17 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#ifdef HACK_BCC_UTIME_BUG
# include <io.h>
# include <fcntl.h>
# ifdef HAVE_UTIME_H
# include <utime.h>
# endif
# ifdef HAVE_SYS_UTIME_H
# include <sys/utime.h>
# endif
#endif
#include "wget.h" #include "wget.h"
#include "utils.h" #include "utils.h"
#include "url.h" #include "url.h"
@ -242,3 +253,30 @@ ws_startup (void)
atexit (ws_cleanup); atexit (ws_cleanup);
SetConsoleCtrlHandler (ws_handler, TRUE); SetConsoleCtrlHandler (ws_handler, TRUE);
} }
/* Replacement utime function for buggy Borland C++Builder 5.5 compiler.
(The Borland utime function only works on Windows NT.) */
#ifdef HACK_BCC_UTIME_BUG
int borland_utime(const char *path, const struct utimbuf *times)
{
int fd;
int res;
struct ftime ft;
struct tm *ptr_tm;
if ((fd = open (path, O_RDWR)) < 0)
return -1;
ptr_tm = localtime (&times->modtime);
ft.ft_tsec = ptr_tm->tm_sec >> 1;
ft.ft_min = ptr_tm->tm_min;
ft.ft_hour = ptr_tm->tm_hour;
ft.ft_day = ptr_tm->tm_mday;
ft.ft_month = ptr_tm->tm_mon + 1;
ft.ft_year = ptr_tm->tm_year - 80;
res = setftime (fd, &ft);
close (fd);
return res;
}
#endif

View File

@ -23,6 +23,14 @@
#define ftruncate chsize #define ftruncate chsize
#define inline __inline #define inline __inline
/* Define if the free Borland C++Builder 5.5 command-line compiler is used,
because its utime() has a bug. */
#define HACK_BCC_UTIME_BUG
#ifdef HACK_BCC_UTIME_BUG
#define utime borland_utime
#endif
/* Define if you have the <alloca.h> header file. */ /* Define if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H #undef HAVE_ALLOCA_H