From: Micah Cowan Date: Sat, 12 Jul 2008 00:16:49 +0000 (-0700) Subject: -i accepts URLs (stsc). For #21265. X-Git-Tag: v1.13~419 X-Git-Url: http://sjero.net/git/?p=wget;a=commitdiff_plain;h=b28a6abfe66e03dae1f749d8215f4ba2b7303e5a -i accepts URLs (stsc). For #21265. --- diff --git a/NEWS b/NEWS index 63665c38..a5774794 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ Please send GNU Wget bug reports to . ** --ask-password option (and associated wgetrc command) added to support password prompts at the console. + +** The --input-file option now also handles retrieving links from +an external file. * Changes in Wget 1.11.4 diff --git a/doc/wget.texi b/doc/wget.texi index 108d7217..50ee459e 100644 --- a/doc/wget.texi +++ b/doc/wget.texi @@ -480,9 +480,9 @@ printed. @cindex input-file @item -i @var{file} @itemx --input-file=@var{file} -Read @sc{url}s from @var{file}. If @samp{-} is specified as -@var{file}, @sc{url}s are read from the standard input. (Use -@samp{./-} to read from a file literally named @samp{-}.) +Read @sc{url}s from a local or external @var{file}. If @samp{-} is +specified as @var{file}, @sc{url}s are read from the standard input. +(Use @samp{./-} to read from a file literally named @samp{-}.) If this function is used, no @sc{url}s need be present on the command line. If there are @sc{url}s both on the command line and in an input diff --git a/src/ChangeLog b/src/ChangeLog index 57a05300..e551f1c9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-06-28 Steven Schubiger + + * retr.c (retrieve_from_file): Allow for reading the links from + an external file (HTTP/FTP). + 2008-06-25 Steven Schubiger * ftp.c (getftp): When spidering a FTP URL, emit a diagnostic diff --git a/src/main.c b/src/main.c index dd6cf029..70387c9c 100644 --- a/src/main.c +++ b/src/main.c @@ -415,7 +415,7 @@ Logging and input file:\n"), N_("\ -nv, --no-verbose turn off verboseness, without being quiet.\n"), N_("\ - -i, --input-file=FILE download URLs found in FILE.\n"), + -i, --input-file=FILE download URLs found in local or external FILE.\n"), N_("\ -F, --force-html treat input file as HTML.\n"), N_("\ diff --git a/src/retr.c b/src/retr.c index 7bdd4193..58e00d2f 100644 --- a/src/retr.c +++ b/src/retr.c @@ -822,10 +822,24 @@ retrieve_from_file (const char *file, bool html, int *count) uerr_t status; struct urlpos *url_list, *cur_url; - url_list = (html ? get_urls_html (file, NULL, NULL) - : get_urls_file (file)); + char *input_file = NULL; + const char *url = file; + status = RETROK; /* Suppose everything is OK. */ *count = 0; /* Reset the URL count. */ + + if (url_has_scheme (url)) + { + uerr_t status; + status = retrieve_url (url, &input_file, NULL, NULL, NULL, false); + if (status != RETROK) + return status; + } + else + input_file = (char *) file; + + url_list = (html ? get_urls_html (input_file, NULL, NULL) + : get_urls_file (input_file)); for (cur_url = url_list; cur_url; cur_url = cur_url->next, ++*count) {