From f33c27562106ccbd12f7fcdeb6f38aa153183463 Mon Sep 17 00:00:00 2001 From: Steven Schubiger Date: Sun, 16 Nov 2008 20:53:58 +0100 Subject: [PATCH] Move numurls out of options struct. --- src/ChangeLog | 8 ++++++++ src/ftp.c | 5 +++-- src/http.c | 6 ++++-- src/main.c | 5 ++++- src/options.h | 4 ---- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 407ee757..688b9595 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2008-11-16 Steven Schubiger + + * main.c: Declare and initialize the numurls counter. + + * ftp.c, http.c: Make the counter visible here and use it. + + * options.h: Remove old declaration from options struct. + 2008-11-15 Steven Schubiger * init.c (defaults): Set default waitretry value. diff --git a/src/ftp.c b/src/ftp.c index 9f65cc34..e4b90189 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -69,6 +69,7 @@ typedef struct struct url *proxy; /* FTWK-style proxy */ } ccon; +extern int numurls; /* Look for regexp "( *[0-9]+ *byte" (literal parenthesis) anywhere in the string S, and return the number converted to wgint, if found, 0 @@ -1295,7 +1296,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con) number of bytes and files downloaded. */ { total_downloaded_bytes += len; - opt.numurls++; + numurls++; } /* Deletion of listing files is not controlled by --delete-after, but @@ -1310,7 +1311,7 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con) for instance, may want to know how many bytes and files they've downloaded through it. */ total_downloaded_bytes += len; - opt.numurls++; + numurls++; if (opt.delete_after) { diff --git a/src/http.c b/src/http.c index 0866f922..9e5074a1 100644 --- a/src/http.c +++ b/src/http.c @@ -142,6 +142,8 @@ struct request { int hcount, hcapacity; }; +extern int numurls; + /* Create a new, empty request. At least request_set_method must be called before the request can be used. */ @@ -2760,7 +2762,7 @@ Remote file exists.\n\n")); number_to_static_string (hstat.contlen), hstat.local_file, count); } - ++opt.numurls; + ++numurls; total_downloaded_bytes += hstat.len; /* Remember that we downloaded the file for later ".orig" code. */ @@ -2788,7 +2790,7 @@ Remote file exists.\n\n")); tms, u->url, number_to_static_string (hstat.len), hstat.local_file, count); } - ++opt.numurls; + ++numurls; total_downloaded_bytes += hstat.len; /* Remember that we downloaded the file for later ".orig" code. */ diff --git a/src/main.c b/src/main.c index 9bae2d23..02ecb1d6 100644 --- a/src/main.c +++ b/src/main.c @@ -80,6 +80,9 @@ static void redirect_output_signal (int); #endif const char *exec_name; + +/* Number of successfully downloaded URLs */ +int numurls = 0; #ifndef TESTING /* Initialize I18N/L10N. That amounts to invoking setlocale, and @@ -1231,7 +1234,7 @@ WARNING: Can't reopen standard output in binary mode;\n\ logprintf (LOG_NOTQUIET, _("FINISHED --%s--\nDownloaded: %d files, %s in %s (%s)\n"), datetime_str (time (NULL)), - opt.numurls, + numurls, human_readable (total_downloaded_bytes), secs_to_human_time (total_download_time), retr_rate (total_downloaded_bytes, total_download_time)); diff --git a/src/options.h b/src/options.h index ba39ec4e..18f031c4 100644 --- a/src/options.h +++ b/src/options.h @@ -124,10 +124,6 @@ struct options SUM_SIZE_INT quota; /* Maximum file size to download and store. */ - int numurls; /* Number of successfully downloaded - URLs #### should be removed because - it's not a setting, but a global var */ - bool server_response; /* Do we print server response? */ bool save_headers; /* Do we save headers together with file? */