Sophie

Sophie

distrib > Mageia > 2 > x86_64 > by-pkgid > 4bc8b713746a9922544f5f16a8a469bf > files > 5

wget-1.13.4-2.mga2.src.rpm

--- ftp.c.orig	2011-10-25 15:51:43.528028918 +0200
+++ src/ftp.c	2011-10-25 15:52:10.801495231 +0200
@@ -1180,7 +1180,7 @@
           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 && file_exists_p (con->target))
--- http.c.orig	2011-10-25 15:52:17.495345986 +0200
+++ src/http.c	2011-10-25 15:52:46.503032710 +0200
@@ -1492,7 +1492,7 @@
 /* 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
--- init.c.orig	2011-10-25 15:52:53.098871012 +0200
+++ src/init.c	2011-10-25 15:54:02.063636078 +0200
@@ -164,6 +164,7 @@
   { "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 },
--- main.c.orig	2011-10-25 15:54:14.196178062 +0200
+++ src/main.c	2011-10-25 16:04:32.604774608 +0200
@@ -196,6 +196,7 @@
     { "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 },
@@ -463,6 +464,8 @@
     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_("\
@@ -1136,10 +1139,24 @@
   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 (1);
+    }
 #ifdef ENABLE_IPV6
   if (opt.ipv4_only && opt.ipv6_only)
     {
--- options.h.orig	2011-10-25 16:04:37.514398602 +0200
+++ src/options.h	2011-10-25 16:05:22.260085549 +0200
@@ -53,6 +53,7 @@
   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;			/* remove file before clobbering */
--- url.c.orig	2011-10-25 16:05:35.667789600 +0200
+++ src/url.c	2011-10-25 16:06:45.752697024 +0200
@@ -1584,6 +1584,7 @@
   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.
@@ -1592,7 +1593,7 @@
      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)))
     {
       unique = fname;