wget: don't notify on download begin and end if quiet

When printing notification on download start and end,
mistakenly, it didn't respect the quiet option

function                                             old     new   delta
retrieve_file_data                                   561     579     +18
wget_main                                           2432    2437      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 23/0)               Total: 23 bytes

Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Martin Lewis 2019-01-10 13:59:30 +01:00 committed by Denys Vlasenko
parent edb74f4019
commit 94e748d027

View File

@ -876,10 +876,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
polldata.fd = fileno(dfp); polldata.fd = fileno(dfp);
polldata.events = POLLIN | POLLPRI; polldata.events = POLLIN | POLLPRI;
#endif #endif
if (G.output_fd == 1) if (!(option_mask32 & WGET_OPT_QUIET)) {
fprintf(stderr, "writing to stdout\n"); if (G.output_fd == 1)
else fprintf(stderr, "writing to stdout\n");
fprintf(stderr, "saving to '%s'\n", G.fname_out); else
fprintf(stderr, "saving to '%s'\n", G.fname_out);
}
progress_meter(PROGRESS_START); progress_meter(PROGRESS_START);
if (G.chunked) if (G.chunked)
@ -1025,10 +1027,12 @@ static void NOINLINE retrieve_file_data(FILE *dfp)
G.chunked = 0; /* makes it show 100% even for chunked download */ G.chunked = 0; /* makes it show 100% even for chunked download */
G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */
progress_meter(PROGRESS_END); progress_meter(PROGRESS_END);
if (G.output_fd == 1) if (!(option_mask32 & WGET_OPT_QUIET)) {
fprintf(stderr, "written to stdout\n"); if (G.output_fd == 1)
else fprintf(stderr, "written to stdout\n");
fprintf(stderr, "'%s' saved\n", G.fname_out); else
fprintf(stderr, "'%s' saved\n", G.fname_out);
}
} }
static void download_one_url(const char *url) static void download_one_url(const char *url)
@ -1389,7 +1393,8 @@ However, in real world it was observed that some web servers
G.output_fd = -1; G.output_fd = -1;
} }
} else { } else {
fprintf(stderr, "remote file exists\n"); if (!(option_mask32 & WGET_OPT_QUIET))
fprintf(stderr, "remote file exists\n");
} }
if (dfp != sfp) { if (dfp != sfp) {