Tomas Hozza <[email protected]> writes: > Options undocumented at all: > --backups > --no-backups
I have two patches here for --backups, one related to VMS and untested. Could someone please proof-read the documentation bits? Also, I am not sure about the --backups semantic, for example I think it should imply -N. What do you think? >From 5ed6d89d837792924bcd7ea7ba589166142d167d Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano <[email protected]> Date: Mon, 8 Jul 2013 23:23:51 +0200 Subject: [PATCH 1/2] vms: support --backups --- src/ChangeLog | 4 ++++ src/retr.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 0240976..4dc8bbe 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2013-07-08 Giuseppe Scrivano <[email protected]> + + * retr.c (rotate_backups): Support for VMS files. + 2013-06-26 Darshit Shah <[email protected]> * http.c (gethttp): Reverse change by commit 90896 that prevented diff --git a/src/retr.c b/src/retr.c index 3d51ef9..ab1053e 100644 --- a/src/retr.c +++ b/src/retr.c @@ -1194,8 +1194,15 @@ rotate_backups(const char *fname) for (i = opt.backups; i > 1; i--) { - sprintf (from, "%s.%d", fname, i - 1); - sprintf (to, "%s.%d", fname, i); + const char *sep; +# ifdef __VMS + sep = "_"; +#else + sep = "."; +#endif + + sprintf (from, "%s%s%d", fname, sep, i - 1); + sprintf (to, "%s%s%d", fname, sep, i); rename (from, to); } -- 1.8.3.1 >From d471791d1a8a7e5ed97e0a19a1c73de180aece2a Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano <[email protected]> Date: Tue, 9 Jul 2013 00:50:30 +0200 Subject: [PATCH 2/2] doc: document --backups --- doc/ChangeLog | 6 ++++++ doc/wget.texi | 14 +++++++++++--- src/ChangeLog | 5 +++++ src/main.c | 3 +++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/doc/ChangeLog b/doc/ChangeLog index 1a70e3c..7972d62 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2013-07-09 Giuseppe Scrivano <[email protected]> + + * wget.texi (Download Options): Add documentation for --backups. + (Wgetrc Commands): Add documentation for backups. + Reported by: Tomas Hozza <[email protected]>. + 2013-06-17 Dave Reisner <[email protected]> (tiny change) * texi2pod.pl: Fix formatting error that causes build to fail with diff --git a/doc/wget.texi b/doc/wget.texi index 710f0ac..8fa4a93 100644 --- a/doc/wget.texi +++ b/doc/wget.texi @@ -630,6 +630,12 @@ Note that when @samp{-nc} is specified, files with the suffixes @samp{.html} or @samp{.htm} will be loaded from the local disk and parsed as if they had been retrieved from the Web. +@cindex backing up files +@item --backups=@var{backups} +Before write a file, back up the original version adding a @samp{.1} +suffix to the file name. Eventual existing backups will be rotated up +to @var{backups} files incrementing the suffix by one. + @cindex continue retrieval @cindex incomplete downloads @cindex resume download @@ -2873,9 +2879,11 @@ enables it). Enable/disable saving pre-converted files with the suffix @samp{.orig}---the same as @samp{-K} (which enables it). -@c @item backups = @var{number} -@c #### Document me! -@c +@item backups = @var{number} +Use up to @var{number} backups for a file. Backups are rotated by +adding an incremental counter that starts at @samp{1}. The default is +@samp{0}. + @item base = @var{string} Consider relative @sc{url}s in input files (specified via the @samp{input} command or the @samp{--input-file}/@samp{-i} option, diff --git a/src/ChangeLog b/src/ChangeLog index 4dc8bbe..978d91a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-07-09 Giuseppe Scrivano <[email protected]> + + * main.c (print_help): Document --backups. + Reported by: Tomas Hozza <[email protected]>. + 2013-07-08 Giuseppe Scrivano <[email protected]> * retr.c (rotate_backups): Support for VMS files. diff --git a/src/main.c b/src/main.c index c895c4e..8ce0eb3 100644 --- a/src/main.c +++ b/src/main.c @@ -714,6 +714,9 @@ Recursive download:\n"), N_("\ -k, --convert-links make links in downloaded HTML or CSS point to\n\ local files.\n"), + N_("\ + --backups=N before writing file X, rotate up to N backup files.\n"), + #ifdef __VMS N_("\ -K, --backup-converted before converting file X, back up as X_orig.\n"), -- 1.8.3.1 -- Giuseppe
