mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
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.
This commit is contained in:
parent
8c28fd7849
commit
1bca5ed886
@ -62,15 +62,18 @@ int wget_main(int argc, char **argv)
|
||||
long beg_range = 0L; /* range at which continue begins */
|
||||
int got_clen = 0; /* got content-length: from server */
|
||||
FILE *output; /* socket to web server */
|
||||
|
||||
int quiet_flag = FALSE;
|
||||
/*
|
||||
* Crack command line.
|
||||
*/
|
||||
while ((n = getopt(argc, argv, "cO:")) != EOF) {
|
||||
while ((n = getopt(argc, argv, "cqO:")) != EOF) {
|
||||
switch (n) {
|
||||
case 'c':
|
||||
++do_continue;
|
||||
break;
|
||||
case 'q':
|
||||
quiet_flag = TRUE;
|
||||
break;
|
||||
case 'O':
|
||||
/* can't set fname_out to NULL if outputting to stdout, because
|
||||
* this gets interpreted as the auto-gen output filename
|
||||
@ -196,13 +199,15 @@ int wget_main(int argc, char **argv)
|
||||
*/
|
||||
#ifdef BB_FEATURE_STATUSBAR
|
||||
statbytes=0;
|
||||
progressmeter(-1);
|
||||
if (quiet_flag==FALSE)
|
||||
progressmeter(-1);
|
||||
#endif
|
||||
while (filesize > 0 && (n = fread(buf, 1, sizeof(buf), sfp)) > 0) {
|
||||
fwrite(buf, 1, n, output);
|
||||
#ifdef BB_FEATURE_STATUSBAR
|
||||
statbytes+=n;
|
||||
progressmeter(1);
|
||||
if (quiet_flag==FALSE)
|
||||
progressmeter(1);
|
||||
#endif
|
||||
if (got_clen)
|
||||
filesize -= n;
|
||||
@ -486,7 +491,7 @@ progressmeter(int flag)
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $
|
||||
* $Id: wget.c,v 1.12 2000/12/09 08:12:06 bug1 Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
15
wget.c
15
wget.c
@ -62,15 +62,18 @@ int wget_main(int argc, char **argv)
|
||||
long beg_range = 0L; /* range at which continue begins */
|
||||
int got_clen = 0; /* got content-length: from server */
|
||||
FILE *output; /* socket to web server */
|
||||
|
||||
int quiet_flag = FALSE;
|
||||
/*
|
||||
* Crack command line.
|
||||
*/
|
||||
while ((n = getopt(argc, argv, "cO:")) != EOF) {
|
||||
while ((n = getopt(argc, argv, "cqO:")) != EOF) {
|
||||
switch (n) {
|
||||
case 'c':
|
||||
++do_continue;
|
||||
break;
|
||||
case 'q':
|
||||
quiet_flag = TRUE;
|
||||
break;
|
||||
case 'O':
|
||||
/* can't set fname_out to NULL if outputting to stdout, because
|
||||
* this gets interpreted as the auto-gen output filename
|
||||
@ -196,13 +199,15 @@ int wget_main(int argc, char **argv)
|
||||
*/
|
||||
#ifdef BB_FEATURE_STATUSBAR
|
||||
statbytes=0;
|
||||
progressmeter(-1);
|
||||
if (quiet_flag==FALSE)
|
||||
progressmeter(-1);
|
||||
#endif
|
||||
while (filesize > 0 && (n = fread(buf, 1, sizeof(buf), sfp)) > 0) {
|
||||
fwrite(buf, 1, n, output);
|
||||
#ifdef BB_FEATURE_STATUSBAR
|
||||
statbytes+=n;
|
||||
progressmeter(1);
|
||||
if (quiet_flag==FALSE)
|
||||
progressmeter(1);
|
||||
#endif
|
||||
if (got_clen)
|
||||
filesize -= n;
|
||||
@ -486,7 +491,7 @@ progressmeter(int flag)
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: wget.c,v 1.11 2000/12/07 22:42:11 andersen Exp $
|
||||
* $Id: wget.c,v 1.12 2000/12/09 08:12:06 bug1 Exp $
|
||||
*/
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user