diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2000-12-09 08:12:06 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2000-12-09 08:12:06 +0000 |
commit | 1bca5ed886322f49fddd4b05ca76fd3a1906d98b (patch) | |
tree | 4319728b78b9262ad1cf67522f307e6791fa36d2 | |
parent | 8c28fd78495311c985690157eebb06300069ba26 (diff) | |
download | busybox-w32-1bca5ed886322f49fddd4b05ca76fd3a1906d98b.tar.gz busybox-w32-1bca5ed886322f49fddd4b05ca76fd3a1906d98b.tar.bz2 busybox-w32-1bca5ed886322f49fddd4b05ca76fd3a1906d98b.zip |
add quiet mode support.
If wget compiled without statusbar then -q option is accepted but has no effect.
If wget compiled with statusbar -q turns it off.
-rw-r--r-- | networking/wget.c | 15 | ||||
-rw-r--r-- | wget.c | 15 |
2 files changed, 20 insertions, 10 deletions
diff --git a/networking/wget.c b/networking/wget.c index 9b8fedd1f..9e150769c 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -62,15 +62,18 @@ int wget_main(int argc, char **argv) | |||
62 | long beg_range = 0L; /* range at which continue begins */ | 62 | long beg_range = 0L; /* range at which continue begins */ |
63 | int got_clen = 0; /* got content-length: from server */ | 63 | int got_clen = 0; /* got content-length: from server */ |
64 | FILE *output; /* socket to web server */ | 64 | FILE *output; /* socket to web server */ |
65 | 65 | int quiet_flag = FALSE; | |
66 | /* | 66 | /* |
67 | * Crack command line. | 67 | * Crack command line. |
68 | */ | 68 | */ |
69 | while ((n = getopt(argc, argv, "cO:")) != EOF) { | 69 | while ((n = getopt(argc, argv, "cqO:")) != EOF) { |
70 | switch (n) { | 70 | switch (n) { |
71 | case 'c': | 71 | case 'c': |
72 | ++do_continue; | 72 | ++do_continue; |
73 | break; | 73 | break; |
74 | case 'q': | ||
75 | quiet_flag = TRUE; | ||
76 | break; | ||
74 | case 'O': | 77 | case 'O': |
75 | /* can't set fname_out to NULL if outputting to stdout, because | 78 | /* can't set fname_out to NULL if outputting to stdout, because |
76 | * this gets interpreted as the auto-gen output filename | 79 | * this gets interpreted as the auto-gen output filename |
@@ -196,13 +199,15 @@ int wget_main(int argc, char **argv) | |||
196 | */ | 199 | */ |
197 | #ifdef BB_FEATURE_STATUSBAR | 200 | #ifdef BB_FEATURE_STATUSBAR |
198 | statbytes=0; | 201 | statbytes=0; |
199 | progressmeter(-1); | 202 | if (quiet_flag==FALSE) |
203 | progressmeter(-1); | ||
200 | #endif | 204 | #endif |
201 | while (filesize > 0 && (n = fread(buf, 1, sizeof(buf), sfp)) > 0) { | 205 | while (filesize > 0 && (n = fread(buf, 1, sizeof(buf), sfp)) > 0) { |
202 | fwrite(buf, 1, n, output); | 206 | fwrite(buf, 1, n, output); |
203 | #ifdef BB_FEATURE_STATUSBAR | 207 | #ifdef BB_FEATURE_STATUSBAR |
204 | statbytes+=n; | 208 | statbytes+=n; |
205 | progressmeter(1); | 209 | if (quiet_flag==FALSE) |
210 | progressmeter(1); | ||
206 | #endif | 211 | #endif |
207 | if (got_clen) | 212 | if (got_clen) |
208 | filesize -= n; | 213 | filesize -= n; |
@@ -486,7 +491,7 @@ progressmeter(int flag) | |||
486 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 491 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
487 | * SUCH DAMAGE. | 492 | * SUCH DAMAGE. |
488 | * | 493 | * |
489 | * $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $ | 494 | * $Id: wget.c,v 1.12 2000/12/09 08:12:06 bug1 Exp $ |
490 | */ | 495 | */ |
491 | 496 | ||
492 | 497 | ||
@@ -62,15 +62,18 @@ int wget_main(int argc, char **argv) | |||
62 | long beg_range = 0L; /* range at which continue begins */ | 62 | long beg_range = 0L; /* range at which continue begins */ |
63 | int got_clen = 0; /* got content-length: from server */ | 63 | int got_clen = 0; /* got content-length: from server */ |
64 | FILE *output; /* socket to web server */ | 64 | FILE *output; /* socket to web server */ |
65 | 65 | int quiet_flag = FALSE; | |
66 | /* | 66 | /* |
67 | * Crack command line. | 67 | * Crack command line. |
68 | */ | 68 | */ |
69 | while ((n = getopt(argc, argv, "cO:")) != EOF) { | 69 | while ((n = getopt(argc, argv, "cqO:")) != EOF) { |
70 | switch (n) { | 70 | switch (n) { |
71 | case 'c': | 71 | case 'c': |
72 | ++do_continue; | 72 | ++do_continue; |
73 | break; | 73 | break; |
74 | case 'q': | ||
75 | quiet_flag = TRUE; | ||
76 | break; | ||
74 | case 'O': | 77 | case 'O': |
75 | /* can't set fname_out to NULL if outputting to stdout, because | 78 | /* can't set fname_out to NULL if outputting to stdout, because |
76 | * this gets interpreted as the auto-gen output filename | 79 | * this gets interpreted as the auto-gen output filename |
@@ -196,13 +199,15 @@ int wget_main(int argc, char **argv) | |||
196 | */ | 199 | */ |
197 | #ifdef BB_FEATURE_STATUSBAR | 200 | #ifdef BB_FEATURE_STATUSBAR |
198 | statbytes=0; | 201 | statbytes=0; |
199 | progressmeter(-1); | 202 | if (quiet_flag==FALSE) |
203 | progressmeter(-1); | ||
200 | #endif | 204 | #endif |
201 | while (filesize > 0 && (n = fread(buf, 1, sizeof(buf), sfp)) > 0) { | 205 | while (filesize > 0 && (n = fread(buf, 1, sizeof(buf), sfp)) > 0) { |
202 | fwrite(buf, 1, n, output); | 206 | fwrite(buf, 1, n, output); |
203 | #ifdef BB_FEATURE_STATUSBAR | 207 | #ifdef BB_FEATURE_STATUSBAR |
204 | statbytes+=n; | 208 | statbytes+=n; |
205 | progressmeter(1); | 209 | if (quiet_flag==FALSE) |
210 | progressmeter(1); | ||
206 | #endif | 211 | #endif |
207 | if (got_clen) | 212 | if (got_clen) |
208 | filesize -= n; | 213 | filesize -= n; |
@@ -486,7 +491,7 @@ progressmeter(int flag) | |||
486 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 491 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
487 | * SUCH DAMAGE. | 492 | * SUCH DAMAGE. |
488 | * | 493 | * |
489 | * $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $ | 494 | * $Id: wget.c,v 1.12 2000/12/09 08:12:06 bug1 Exp $ |
490 | */ | 495 | */ |
491 | 496 | ||
492 | 497 | ||