1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Make --backups work as documented

This commit is contained in:
Giuseppe Scrivano 2013-07-10 20:59:34 +02:00
parent 44ba49b31f
commit c52bbad9e4
5 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,11 @@
2013-07-10 Giuseppe Scrivano <gscrivano@gnu.org>
* http.c (read_response_body) [ALLOW_CLOBBER]: Move definition to..
* options.h (struct options): Make `backups' an int.
* url.h [ALLOW_CLOBBER]: .. Here. Do not clobber when backups are used.
* url.c (url_file_name): Use the ALLOW_CLOBBER macro instead of
repeating the code.
2013-07-08 Steven M. Schweda <sms@antinode.info> 2013-07-08 Steven M. Schweda <sms@antinode.info>
* retr.c (rotate_backups): Support for VMS files. * retr.c (rotate_backups): Support for VMS files.

View File

@ -1641,12 +1641,6 @@ read_response_body (struct http_stat *hs, int sock, FILE *fp, wgint contlen,
} while (0) } while (0)
#endif /* def __VMS [else] */ #endif /* def __VMS [else] */
/* 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 \
|| opt.dirstruct || opt.output_document)
/* Retrieve a document through HTTP protocol. It recognizes status /* Retrieve a document through HTTP protocol. It recognizes status
code, and correctly handles redirections. It closes the network code, and correctly handles redirections. It closes the network
socket. If it receives an error from the functions below it, it socket. If it receives an error from the functions below it, it

View File

@ -166,7 +166,7 @@ struct options
bool timestamping; /* Whether to use time-stamping. */ bool timestamping; /* Whether to use time-stamping. */
bool backup_converted; /* Do we save pre-converted files as *.orig? */ bool backup_converted; /* Do we save pre-converted files as *.orig? */
bool backups; /* Are numeric backups made? */ int backups; /* Are numeric backups made? */
char *useragent; /* User-Agent string, which can be set char *useragent; /* User-Agent string, which can be set
to something other than Wget. */ to something other than Wget. */

View File

@ -1669,11 +1669,12 @@ url_file_name (const struct url *u, char *replaced_filename)
2) Retrieval with regetting. 2) Retrieval with regetting.
3) Timestamping is used. 3) Timestamping is used.
4) Hierarchy is built. 4) Hierarchy is built.
5) Backups are specified.
The exception is the case when file does exist and is a The exception is the case when file does exist and is a
directory (see `mkalldirs' for explanation). */ directory (see `mkalldirs' for explanation). */
if ((opt.noclobber || opt.always_rest || opt.timestamping || opt.dirstruct) if (ALLOW_CLOBBER
&& !(file_exists_p (fname) && !file_non_directory_p (fname))) && !(file_exists_p (fname) && !file_non_directory_p (fname)))
{ {
unique = fname; unique = fname;

View File

@ -47,6 +47,12 @@ as that of the covered work. */
* file descriptor. */ * file descriptor. */
#define CHOMP_BUFFER 19 #define CHOMP_BUFFER 19
/* 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 \
|| opt.dirstruct || opt.output_document || opt.backups > 0)
/* Specifies how, or whether, user auth information should be included /* Specifies how, or whether, user auth information should be included
* in URLs regenerated from URL parse structures. */ * in URLs regenerated from URL parse structures. */
enum url_auth_mode { enum url_auth_mode {