diff options
author | Martin Lewis <martin.lewis.x84@gmail.com> | 2019-01-04 18:26:04 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2019-01-04 18:27:28 +0100 |
commit | 46fc3290c20a0468c02bd771a8c548c0e1b23e47 (patch) | |
tree | f358007af8a664e40d49c296933148f89744aa83 | |
parent | 64f35361f42946e6e19bcbaa5a8be7b58a159c42 (diff) | |
download | busybox-w32-46fc3290c20a0468c02bd771a8c548c0e1b23e47.tar.gz busybox-w32-46fc3290c20a0468c02bd771a8c548c0e1b23e47.tar.bz2 busybox-w32-46fc3290c20a0468c02bd771a8c548c0e1b23e47.zip |
wget: notify on download begin and end
When using -o to file the progress meter is not displayed, so write that
we started the download and that we finished it.
function old new delta
retrieve_file_data 465 561 +96
wget_main 2412 2432 +20
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 116/0) Total: 116 bytes
text data bss dec hex filename
979022 485 7296 986803 f0eb3 busybox_old
979224 485 7296 987005 f0f7d busybox_unstripped
Signed-off-by: Martin Lewis <martin.lewis.x84@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | networking/wget.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/networking/wget.c b/networking/wget.c index da629ccb9..3a02de6ca 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -876,6 +876,10 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
876 | polldata.fd = fileno(dfp); | 876 | polldata.fd = fileno(dfp); |
877 | polldata.events = POLLIN | POLLPRI; | 877 | polldata.events = POLLIN | POLLPRI; |
878 | #endif | 878 | #endif |
879 | if (G.output_fd == 1) | ||
880 | fprintf(stderr, "writing to stdout\n"); | ||
881 | else | ||
882 | fprintf(stderr, "saving to '%s'\n", G.fname_out); | ||
879 | progress_meter(PROGRESS_START); | 883 | progress_meter(PROGRESS_START); |
880 | 884 | ||
881 | if (G.chunked) | 885 | if (G.chunked) |
@@ -1021,6 +1025,10 @@ static void NOINLINE retrieve_file_data(FILE *dfp) | |||
1021 | G.chunked = 0; /* makes it show 100% even for chunked download */ | 1025 | G.chunked = 0; /* makes it show 100% even for chunked download */ |
1022 | G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ | 1026 | G.got_clen = 1; /* makes it show 100% even for download of (formerly) unknown size */ |
1023 | progress_meter(PROGRESS_END); | 1027 | progress_meter(PROGRESS_END); |
1028 | if (G.output_fd == 1) | ||
1029 | fprintf(stderr, "written to stdout\n"); | ||
1030 | else | ||
1031 | fprintf(stderr, "'%s' saved\n", G.fname_out); | ||
1024 | } | 1032 | } |
1025 | 1033 | ||
1026 | static void download_one_url(const char *url) | 1034 | static void download_one_url(const char *url) |
@@ -1380,6 +1388,8 @@ However, in real world it was observed that some web servers | |||
1380 | xclose(G.output_fd); | 1388 | xclose(G.output_fd); |
1381 | G.output_fd = -1; | 1389 | G.output_fd = -1; |
1382 | } | 1390 | } |
1391 | } else { | ||
1392 | fprintf(stderr, "remote file exists\n"); | ||
1383 | } | 1393 | } |
1384 | 1394 | ||
1385 | if (dfp != sfp) { | 1395 | if (dfp != sfp) { |