]> sjero.net Git - wget/commitdiff
Downgrade -r, -p with -O to a warning rather than an error; elaborate about bad combi...
authorMicah Cowan <micah@cowan.name>
Sun, 27 Apr 2008 09:15:31 +0000 (02:15 -0700)
committerMicah Cowan <micah@cowan.name>
Sun, 27 Apr 2008 09:15:31 +0000 (02:15 -0700)
doc/ChangeLog
doc/wget.texi
src/ChangeLog
src/main.c

index af44b39e02ef40140b67823d59062b58332b9f54..7157a7681ffb2f3b9075f25e0de08d9ff1397f3c 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-27  Micah Cowan  <micah@cowan.name>
+
+       * wget.texi (Download Options) <-O>: Elaborate on why certain
+       options make poor combinations with -O.
+
 2008-04-22  Mike Frysinger  <vapier@gentoo.org>
 
        * sample.wgetrc: Added prefer_family example. Resolves bug
index 583c7fcf2ab370df8583ab45f17d202cef2a8b98..7a949bfe52ca2052230bda1c9e1ac4d46322d311 100644 (file)
@@ -551,9 +551,23 @@ analogous to shell redirection:
 @samp{wget -O - http://foo > file}; @file{file} will be truncated
 immediately, and @emph{all} downloaded content will be written there.
 
+For this reason, @samp{-N} (for timestamp-checking) is not supported
+in combination with @samp{-O}: since @var{file} is always newly
+created, it will always have a very new timestamp. Contrary to some
+users' expectations, the combination has never worked, and as of
+version 1.11, it results in an error.
+
+Similarly, using @samp{-r} or @samp{-p} with @samp{-O} may not work as
+you expect: Wget won't just download the first file to @var{file} and
+then download the rest to their normal names: @emph{all} downloaded
+content will be placed in @var{file}. This was disabled in version
+1.11, but has been reinstated (with a warning) in 1.11.2, as there are
+some cases where this behavior can actually have some use.
+
 Note that a combination with @samp{-k} is only permitted when
-downloading a single document, and combination with any of @samp{-r},
-@samp{-p}, or @samp{-N} is not allowed.
+downloading a single document, as in that case it will just convert
+all relative URIs to external ones; @samp{-k} makes no sense for
+multiple URIs when they're all being downloaded to a single file.
 
 @cindex clobbering, file
 @cindex downloading multiple times
index 2f8464bdd35a9d020b2cb7bde9a67786b3849519..24ab91756397920095bb4c24d49d34eaccab6b33 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-27  Micah Cowan  <micah@cowan.name>
+
+       * main.c (main): Downgrade -r, -p with -O to a warning rather than
+       an error; elaborate just a bit more for other -O combination
+       cases.
+
 2008-04-26  Micah Cowan  <micah@cowan.name>
 
        * http.c (gethttp): Move proxy CONNECT handling to below the
index b1e99695f19f124bc45af691a145be5b9324bc98..1ad0a48cc8c273ae559e426132034b13f9109ef0 100644 (file)
@@ -880,22 +880,31 @@ Can't timestamp and not clobber old files at the same time.\n"));
       exit (1);
     }
 #endif
-  if (opt.output_document
-      && (opt.page_requisites
-          || opt.recursive
-          || opt.timestamping))
+  if (opt.output_document)
     {
-          printf (_("Cannot specify -r, -p or -N if -O is given.\n"));
+      if (opt.convert_links 
+          && (nurl > 1 || opt.page_requisites || opt.recursive))
+        {
+          fputs (_("\
+Cannot specify both -k and -O if multiple URLs are given, or in combination\n\
+with -p or -r. See the manual for details.\n\n"), stdout);
           print_usage ();
           exit (1);
-    }
-  if (opt.output_document
-      && opt.convert_links 
-      && nurl > 1)
-    {
-          printf (_("Cannot specify both -k and -O if multiple URLs are given.\n"));
+        }
+      if (opt.page_requisites
+          || opt.recursive)
+        {
+          logprintf (LOG_NOTQUIET, "%s", _("\
+WARNING: combining -O with -r or -p will mean that all downloaded content\n\
+will be placed in the single file you specified.\n\n"));
+        }
+      if (opt.timestamping)
+        {
+          fputs (_("\
+Cannot specify -N if -O is given. See the manual for details.\n\n"), stdout);
           print_usage ();
           exit (1);
+        }
     }
 
   if (!nurl && !opt.input_filename)