Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > cbe940bb6c646643f1f9e48eae1b171a > files > 4

wget-1.20.3-1.mga6.src.rpm

diff -Naurp wget-1.17/src/ftp.c wget-1.17.oden/src/ftp.c
--- wget-1.17/src/ftp.c	2015-11-09 15:24:06.000000000 +0000
+++ wget-1.17.oden/src/ftp.c	2015-11-26 14:43:38.000000000 +0000
@@ -1424,7 +1424,7 @@ Error in server response, closing contro
           fp = fopen (con->target, "ab");
 #endif /* def __VMS [else] */
         }
-      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 || count > 0)
         {
           if (opt.unlink_requested && file_exists_p (con->target, NULL))
diff -Naurp wget-1.17/src/init.c wget-1.17.oden/src/init.c
--- wget-1.17/src/init.c	2015-11-09 15:24:17.000000000 +0000
+++ wget-1.17.oden/src/init.c	2015-11-26 14:43:38.000000000 +0000
@@ -185,6 +185,7 @@ static const 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 },
diff -Naurp wget-1.17/src/main.c wget-1.17.oden/src/main.c
--- wget-1.17/src/main.c	2015-11-15 14:00:22.000000000 +0000
+++ wget-1.17.oden/src/main.c	2015-11-26 14:45:37.000000000 +0000
@@ -287,6 +287,7 @@ static 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 },
@@ -602,6 +603,8 @@ Download:\n"),
     N_("\
   -O,  --output-document=FILE      write documents to FILE\n"),
     N_("\
+  --force-clobber                  clobber existing files.\n"),
+    N_("\
   -nc, --no-clobber                skip downloads that would download to\n\
                                      existing files (overwriting them)\n"),
     N_("\
@@ -1436,7 +1439,21 @@ main (int argc, char **argv)
   if (opt.timestamping && opt.noclobber)
     {
       fprintf (stderr, _("\
-Can't timestamp and not clobber old files at the same time.\n"));
+                         Can't timestamp and not clobber old files at the same time.\n"));
+      print_usage (1);
+      exit (1);
+    }
+    if (opt.timestamping && opt.forceclobber)
+    {
+      printf (_("\
+                +Can't timestamp and force clobber old files at the same time.\n"));
+      print_usage (1);
+      exit (1);
+    }
+    if (opt.forceclobber && opt.noclobber)
+    {
+      printf (_("\
+                +Can't force clobber and not clobber old files at the same time.\n"));
       print_usage (1);
       exit (WGET_EXIT_GENERIC_ERROR);
     }
diff -Naurp wget-1.17/src/options.h wget-1.17.oden/src/options.h
--- wget-1.17/src/options.h	2015-11-09 15:24:17.000000000 +0000
+++ wget-1.17.oden/src/options.h	2015-11-26 14:46:43.000000000 +0000
@@ -53,6 +53,7 @@ struct options
   int cut_dirs;                 /* Number of directory components to cut. */
   bool add_hostdir;             /* Do we add hostname directory? */
   bool protocol_directories;    /* Whether to prepend "http"/"ftp" to dirs. */
+  int forceclobber;             /* Forces clobbering of existing files. */
   bool noclobber;               /* Disables clobbering of existing data. */
   bool unlink_requested;        /* remove file before clobbering */
   char *dir_prefix;             /* The top of directory tree */
diff -Naurp wget-1.17/src/url.c wget-1.17.oden/src/url.c
--- wget-1.17/src/url.c	2015-11-09 15:24:07.000000000 +0000
+++ wget-1.17.oden/src/url.c	2015-11-26 14:43:38.000000000 +0000
@@ -1707,6 +1707,7 @@ url_file_name (const struct url *u, char
   xfree (temp_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.
diff -Naurp wget-1.17/src/url.h wget-1.17.oden/src/url.h
--- wget-1.17/src/url.h	2015-11-09 15:24:07.000000000 +0000
+++ wget-1.17.oden/src/url.h	2015-11-26 14:43:38.000000000 +0000
@@ -51,7 +51,7 @@ as that of the covered work.  */
 /* 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 || opt.backups > 0)
 
 /* Specifies how, or whether, user auth information should be included