Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > 1134671058f89cabf3a10de2e4e055c9 > files > 6

wget-1.10.2-6mdv2008.0.src.rpm

--- wget-1.10.2/src/init.c.force-clobber	2005-08-09 00:54:16.000000000 +0200
+++ wget-1.10.2/src/init.c	2007-06-18 18:41:53.000000000 +0200
@@ -156,6 +156,7 @@ static struct {
   { "excludedomains",	&opt.exclude_domains,	cmd_vector },
   { "followftp",	&opt.follow_ftp,	cmd_boolean },
   { "followtags",	&opt.follow_tags,	cmd_vector },
+  { "forceclobber",	&opt.forceclobber,	cmd_boolean },
   { "forcehtml",	&opt.force_html,	cmd_boolean },
   { "ftppasswd",	&opt.ftp_passwd,	cmd_string }, /* deprecated */
   { "ftppassword",	&opt.ftp_passwd,	cmd_string },
--- wget-1.10.2/src/ftp.c.force-clobber	2005-08-09 00:23:09.000000000 +0200
+++ wget-1.10.2/src/ftp.c	2007-06-18 18:41:53.000000000 +0200
@@ -931,7 +931,7 @@ Error in server response, closing contro
 
       if (restval)
 	fp = fopen (con->target, "ab");
-      else if (opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct
+      else if (opt.forceclobber || opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct
 	       || opt.output_document)
 	fp = fopen (con->target, "wb");
       else
--- wget-1.10.2/src/http.c.force-clobber	2005-08-09 00:54:16.000000000 +0200
+++ wget-1.10.2/src/http.c	2007-06-18 18:41:53.000000000 +0200
@@ -1124,7 +1124,7 @@ time_t http_atotm PARAMS ((const char *)
 /* The flags that allow clobbering the file (opening with "wb").
    Defined here to avoid repetition later.  #### This will require
    rework.  */
-#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
+#define ALLOW_CLOBBER (opt.forceclobber || opt.noclobber || opt.always_rest || opt.timestamping \
 		       || opt.dirstruct || opt.output_document)
 
 /* Retrieve a document through HTTP protocol.  It recognizes status
--- wget-1.10.2/src/main.c.force-clobber	2007-06-18 18:41:53.000000000 +0200
+++ wget-1.10.2/src/main.c	2007-06-18 18:44:50.000000000 +0200
@@ -186,6 +186,7 @@ struct cmdline_option option_data[] =
     { "execute", 'e', OPT__EXECUTE, NULL, required_argument },
     { "follow-ftp", 0, OPT_BOOLEAN, "followftp", -1 },
     { "follow-tags", 0, OPT_VALUE, "followtags", -1 },
+    { "force-clobber", 0, OPT_BOOLEAN, "forceclobber", -1 },
     { "force-directories", 'x', OPT_BOOLEAN, "dirstruct", -1 },
     { "force-html", 'F', OPT_BOOLEAN, "forcehtml", -1 },
     { "ftp-password", 0, OPT_VALUE, "ftppassword", -1 },
@@ -435,6 +436,8 @@ Download:\n"),
   -nc, --no-clobber              skip downloads that would download to\n\
                                  existing files.\n"),
     N_("\
+      --force-clobber            clobber existing files.\n"),
+    N_("\
   -c,  --continue                resume getting a partially-downloaded file.\n"),
     N_("\
        --progress=TYPE           select progress gauge type.\n"),
@@ -839,6 +842,20 @@ Can't timestamp and not clobber old file
       print_usage ();
       exit (1);
     }
+  if (opt.timestamping && opt.forceclobber)
+    {
+      printf (_("\
+Can't timestamp and force clobber old files at the same time.\n"));
+      print_usage ();
+      exit (1);
+    }
+  if (opt.forceclobber && opt.noclobber)
+    {
+      printf (_("\
+Can't force clobber and not clobber old files at the same time.\n"));
+      print_usage ();
+      exit (1);
+    }
 #ifdef ENABLE_IPV6
   if (opt.ipv4_only && opt.ipv6_only)
     {
--- wget-1.10.2/src/url.c.force-clobber	2007-06-18 18:41:53.000000000 +0200
+++ wget-1.10.2/src/url.c	2007-06-18 18:41:53.000000000 +0200
@@ -1506,6 +1506,7 @@ url_file_name (const struct url *u)
   fname = fnres.base;
 
   /* Check the cases in which the unique extensions are not used:
+     0) Clobbering is forced (--force-clobber)
      1) Clobbering is turned off (-nc).
      2) Retrieval with regetting.
      3) Timestamping is used.
@@ -1514,7 +1515,7 @@ url_file_name (const struct url *u)
      The exception is the case when file does exist and is a
      directory (see `mkalldirs' for explanation).  */
 
-  if ((opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct)
+  if ((opt.forceclobber || opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct)
       && !(file_exists_p (fname) && !file_non_directory_p (fname)))
     return fname;
 
--- wget-1.10.2/src/options.h.force-clobber	2005-08-09 00:54:16.000000000 +0200
+++ wget-1.10.2/src/options.h	2007-06-18 18:41:53.000000000 +0200
@@ -48,6 +48,7 @@ struct options
   int cut_dirs;			/* Number of directory components to cut. */
   int add_hostdir;		/* Do we add hostname directory? */
   int protocol_directories;	/* Whether to prepend "http"/"ftp" to dirs. */
+  int forceclobber;		/* Forces clobbering of existing file. */
   int noclobber;		/* Disables clobbering of existing
 				   data. */
   char *dir_prefix;		/* The top of directory tree */