]> sjero.net Git - wget/blobdiff - src/mswindows.c
[svn] Allow unique_name to return the FILE argument unmodified.
[wget] / src / mswindows.c
index f10c61238291b34f1d10702907a6f9e44014e359..53219812e332c93ea1480c67de83a075a0214624 100644 (file)
@@ -15,7 +15,17 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with Wget; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+In addition, as a special exception, the Free Software Foundation
+gives permission to link the code of its release of Wget with the
+OpenSSL project's "OpenSSL" library (or with modified versions of it
+that use the same license as the "OpenSSL" library), and distribute
+the linked executables.  You must obey the GNU General Public License
+in all respects for all of the code used other than "OpenSSL".  If you
+modify this file, you may extend this exception to your version of the
+file, but you are not obligated to do so.  If you do not wish to do
+so, delete this exception statement from your version.  */
 
 /* #### Someone please document what these functions do!  */
 
@@ -28,7 +38,19 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include <assert.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 "utils.h"
 #include "url.h"
 
 #ifndef errno
@@ -114,7 +136,7 @@ fork_to_background (void)
 
   if (!opt.lfilename)
     {
-      opt.lfilename = unique_name (DEFAULT_LOGFILE);
+      opt.lfilename = unique_name (DEFAULT_LOGFILE, 0);
       changedp = 1;
     }
   printf (_("Continuing in background.\n"));
@@ -241,3 +263,30 @@ ws_startup (void)
   atexit (ws_cleanup);
   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