From c38b1a2650ebf4b0b0c7b3aefe6982d52cef3507 Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Sat, 3 May 2014 08:48:00 +0200 Subject: [PATCH] Display progress information in Windows console title ba --- src/ChangeLog | 9 +++++++++ src/ftp.c | 15 +++++++++++---- src/http.c | 12 ++++++++---- src/retr.c | 2 +- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 92942eb..412f366 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2014-05-01 Gisle Vanem + + * ftp.c (ftp_loop_internal): Call url_string() to retrieve a 'hurl' incase + WINDOWS needs to set the console-title. + * http.c (http_loop): Call url_string() to retrieve a 'hurl' incase WINDOWS + needs to set the console-title. + * retr.c (fd_read_body): Update the read-percentage for WINDOWS if + '--show-progress' or NOT '--quiet' are set. + 2014-05-01 Darshit Shah (tiny change) * progress.c (dot_finish): Do not print extra newlines when not in verbose diff --git a/src/ftp.c b/src/ftp.c index 2db98bb..c78256f 100644 --- a/src/ftp.c +++ b/src/ftp.c @@ -1594,6 +1594,8 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi /* THE loop. */ do { + char *hurl; + /* Increment the pass counter. */ ++count; sleep_between_retrievals (count); @@ -1652,21 +1654,26 @@ ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con, char **local_fi /* Get the current time string. */ tms = datetime_str (time (NULL)); + + hurl = url_string (u, URL_AUTH_HIDE_PASSWD); + /* Print fetch message, if opt.verbose. */ if (opt.verbose) { - char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD); char tmp[256]; strcpy (tmp, " "); if (count > 1) sprintf (tmp, _("(try:%2d)"), count); logprintf (LOG_VERBOSE, "--%s-- %s\n %s => %s\n", tms, hurl, tmp, quote (locf)); + } + #ifdef WINDOWS - ws_changetitle (hurl); + if (!opt.quiet || opt.show_progress) + ws_changetitle (hurl); #endif - xfree (hurl); - } + xfree (hurl); + /* Send getftp the proper length, if fileinfo was provided. */ if (f && f->type != FT_SYMLINK) len = f->size; diff --git a/src/http.c b/src/http.c index 9551fb1..0d5217d 100644 --- a/src/http.c +++ b/src/http.c @@ -3088,6 +3088,8 @@ http_loop (struct url *u, struct url *original_url, char **newloc, /* THE loop */ do { + char *hurl; + /* Increment the pass counter. */ ++count; sleep_between_retrievals (count); @@ -3099,10 +3101,11 @@ http_loop (struct url *u, struct url *original_url, char **newloc, logprintf (LOG_VERBOSE, _("\ Spider mode enabled. Check if remote file exists.\n")); + hurl = url_string (u, URL_AUTH_HIDE_PASSWD); + /* Print fetch message, if opt.verbose. */ if (opt.verbose) { - char *hurl = url_string (u, URL_AUTH_HIDE_PASSWD); if (count > 1) { @@ -3116,12 +3119,13 @@ Spider mode enabled. Check if remote file exists.\n")); logprintf (LOG_NOTQUIET, "--%s-- %s\n", tms, hurl); } + } #ifdef WINDOWS - ws_changetitle (hurl); + if (!opt.quiet || opt.show_progress) + ws_changetitle (hurl); #endif - xfree (hurl); - } + xfree (hurl); /* Default document type is empty. However, if spider mode is on or time-stamping is employed, HEAD_ONLY commands is diff --git a/src/retr.c b/src/retr.c index 135f599..8fe12ad 100644 --- a/src/retr.c +++ b/src/retr.c @@ -412,7 +412,7 @@ fd_read_body (const char *downloaded_filename, int fd, FILE *out, wgint toread, if (progress) progress_update (progress, ret, ptimer_read (timer)); #ifdef WINDOWS - if (toread > 0 && opt.show_progress) + if (toread > 0 && (opt.show_progress || !opt.quiet)) ws_percenttitle (100.0 * (startpos + sum_read) / (startpos + toread)); #endif -- 1.9.2