bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] wget: customizable ".listing" file


From: Manfred Schwarb
Subject: [Bug-wget] wget: customizable ".listing" file
Date: Sun, 08 Nov 2009 00:41:16 +0100

Hi,

I would like to issue multiple wget commands in parallel, but then the
hard coded ".listing" file creates troubles.

I.e.

wget -N -q ftp://ftp.gnu.org/gnu/wget/wget-1.12.tar.gz & pid1=$!
wget -N -q ftp://ftp.gnu.org/gnu/wget/wget-1.12.tar.bz2 & pid2=$!

both wget commands write to the same listing file ".listing".



So I had the idea to make this customizable. Would something like
the patch below be acceptable?

With this change I could do

wget --listing-file=".listing.1" -N -q 
ftp://ftp.gnu.org/gnu/wget/wget-1.12.tar.gz & pid1=$!
wget --listing-file=".listing.2" -N -q 
ftp://ftp.gnu.org/gnu/wget/wget-1.12.tar.bz2 & pid2=$!


Thanks,
Manfred



diff -r -Nup wget-1.12//src/ftp.c wget-1.12-modified//src/ftp.c
--- wget-1.12//src/ftp.c        2009-09-22 04:59:21.000000000 +0200
+++ wget-1.12-modified//src/ftp.c       2009-11-07 23:36:39.000000000 +0100
@@ -1605,7 +1605,10 @@ ftp_get_listing (struct url *u, ccon *co
      the URL and replacing the last component with the listing file
      name.  */
   uf = url_file_name (u);
-  lf = file_merge (uf, LIST_FILENAME);
+  if (opt.listing_file)
+    lf = file_merge (uf, opt.listing_file);
+  else
+    lf = file_merge (uf, LIST_FILENAME);
   xfree (uf);
   DEBUGP ((_("Using %s as listing tmp file.\n"), quote (lf)));

diff -r -Nup wget-1.12//src/init.c wget-1.12-modified//src/init.c
--- wget-1.12//src/init.c       2009-09-22 05:02:41.000000000 +0200
+++ wget-1.12-modified//src/init.c      2009-11-08 00:01:35.000000000 +0100
@@ -184,6 +184,7 @@ static const struct {
   { "iri",              &opt.enable_iri,        cmd_boolean },
   { "keepsessioncookies", &opt.keep_session_cookies, cmd_boolean },
   { "limitrate",        &opt.limit_rate,        cmd_bytes },
+  { "listingfile",      &opt.listing_file,      cmd_file },
   { "loadcookies",      &opt.cookies_input,     cmd_file },
   { "localencoding",    &opt.locale,            cmd_string },
   { "logfile",          &opt.lfilename,         cmd_file },
@@ -1579,6 +1580,7 @@ cleanup (void)
   xfree_null (opt.ftp_user);
   xfree_null (opt.ftp_passwd);
   xfree_null (opt.ftp_proxy);
+  xfree_null (opt.listing_file);
   xfree_null (opt.https_proxy);
   xfree_null (opt.http_proxy);
   free_vec (opt.no_proxy);
diff -r -Nup wget-1.12//src/main.c wget-1.12-modified//src/main.c
--- wget-1.12//src/main.c       2009-09-22 05:03:11.000000000 +0200
+++ wget-1.12-modified//src/main.c      2009-11-07 23:15:00.000000000 +0100
@@ -216,6 +216,7 @@ static struct cmdline_option option_data
     { "keep-session-cookies", 0, OPT_BOOLEAN, "keepsessioncookies", -1 },
     { "level", 'l', OPT_VALUE, "reclevel", -1 },
     { "limit-rate", 0, OPT_VALUE, "limitrate", -1 },
+    { "listing-file", 0, OPT_VALUE, "listingfile", -1 },
     { "load-cookies", 0, OPT_VALUE, "loadcookies", -1 },
     { "local-encoding", 0, OPT_VALUE, "localencoding", -1 },
     { "max-redirect", 0, OPT_VALUE, "maxredirect", -1 },
@@ -624,6 +625,8 @@ FTP options:\n"),
        --no-passive-ftp        disable the \"passive\" transfer mode.\n"),
     N_("\
        --retr-symlinks         when recursing, get linked-to files (not 
dir).\n"),
+    N_("\
+       --listing-file=FILE     alternate listing file name instead of 
\".listing\".\n"),
     "\n",

     N_("\
diff -r -Nup wget-1.12//src/options.h wget-1.12-modified//src/options.h
--- wget-1.12//src/options.h    2009-09-22 05:03:47.000000000 +0200
+++ wget-1.12-modified//src/options.h   2009-11-07 23:41:12.000000000 +0100
@@ -95,6 +95,7 @@ struct options
   bool netrc;                  /* Whether to read .netrc. */
   bool ftp_glob;               /* FTP globbing */
   bool ftp_pasv;                       /* Passive FTP. */
+  char *listing_file;          /* FTP listing file */

   char *http_user;             /* HTTP username. */
   char *http_passwd;           /* HTTP password. */







reply via email to

[Prev in Thread] Current Thread [Next in Thread]