Blame SOURCES/wget-1.14-fix-backups-to-work-as-documented.patch

87e294
From c52bbad9e4bad1393a9d6ba37e600d388f5ab419 Mon Sep 17 00:00:00 2001
87e294
From: Giuseppe Scrivano <gscrivano@gnu.org>
87e294
Date: Wed, 10 Jul 2013 20:59:34 +0200
87e294
Subject: [PATCH] Make --backups work as documented
87e294
87e294
---
87e294
 src/http.c    | 6 ------
87e294
 src/options.h | 2 +-
87e294
 src/url.c     | 3 ++-
87e294
 src/url.h     | 6 ++++++
87e294
 4 files changed, 9 insertions(+), 8 deletions(-)
87e294
87e294
diff --git a/src/http.c b/src/http.c
87e294
index 9f274dc..b0c782b 100644
87e294
--- a/src/http.c
87e294
+++ b/src/http.c
87e294
@@ -1641,12 +1641,6 @@ read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen,
87e294
 } while (0)
87e294
 #endif /* def __VMS [else] */
87e294
 
87e294
-/* The flags that allow clobbering the file (opening with "wb").
87e294
-   Defined here to avoid repetition later.  #### This will require
87e294
-   rework.  */
87e294
-#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
87e294
-                       || opt.dirstruct || opt.output_document)
87e294
-
87e294
 /* Retrieve a document through HTTP protocol.  It recognizes status
87e294
    code, and correctly handles redirections.  It closes the network
87e294
    socket.  If it receives an error from the functions below it, it
87e294
diff --git a/src/options.h b/src/options.h
87e294
index ed38617..0a10c9b 100644
87e294
--- a/src/options.h
87e294
+++ b/src/options.h
87e294
@@ -166,7 +166,7 @@ struct options
87e294
   bool timestamping;		/* Whether to use time-stamping. */
87e294
 
87e294
   bool backup_converted;	/* Do we save pre-converted files as *.orig? */
87e294
-  bool backups;			/* Are numeric backups made? */
87e294
+  int backups;			/* Are numeric backups made? */
87e294
 
87e294
   char *useragent;		/* User-Agent string, which can be set
87e294
 				   to something other than Wget. */
87e294
diff --git a/src/url.c b/src/url.c
87e294
index 5e2b9a3..bf9d697 100644
87e294
--- a/src/url.c
87e294
+++ b/src/url.c
87e294
@@ -1669,11 +1669,12 @@ url_file_name (const struct url *u, char *replaced_filename)
87e294
      2) Retrieval with regetting.
87e294
      3) Timestamping is used.
87e294
      4) Hierarchy is built.
87e294
+     5) Backups are specified.
87e294
 
87e294
      The exception is the case when file does exist and is a
87e294
      directory (see `mkalldirs' for explanation).  */
87e294
 
87e294
-  if ((opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct)
87e294
+  if (ALLOW_CLOBBER
87e294
       && !(file_exists_p (fname) && !file_non_directory_p (fname)))
87e294
     {
87e294
       unique = fname;
87e294
diff --git a/src/url.h b/src/url.h
87e294
index b7f4366..cd3782b 100644
87e294
--- a/src/url.h
87e294
+++ b/src/url.h
87e294
@@ -47,6 +47,12 @@ as that of the covered work.  */
87e294
 #define DEFAULT_FTP_PORT 21
87e294
 #define DEFAULT_HTTPS_PORT 443
87e294
 
87e294
+/* The flags that allow clobbering the file (opening with "wb").
87e294
+   Defined here to avoid repetition later.  #### This will require
87e294
+   rework.  */
87e294
+#define ALLOW_CLOBBER (opt.noclobber || opt.always_rest || opt.timestamping \
87e294
+                  || opt.dirstruct || opt.output_document || opt.backups > 0)
87e294
+
87e294
 /* Specifies how, or whether, user auth information should be included
87e294
  * in URLs regenerated from URL parse structures. */
87e294
 enum url_auth_mode {
87e294
-- 
87e294
1.8.3.1
87e294