aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-03-01 13:20:20 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-03-01 13:20:35 +0000
commit75e996f29f1855d47299cf29f96507cd78d5aff1 (patch)
tree59276ca1a44c8257d9979ac7060975dfb5f0caf1 /src
parent5513bbd5c38e5128dd943c28417da29f2c6f9101 (diff)
tool: Moved --progress-bar to the global config
Diffstat (limited to 'src')
-rw-r--r--src/tool_cfgable.h4
-rw-r--r--src/tool_getparam.c8
-rw-r--r--src/tool_operate.c18
3 files changed, 15 insertions, 15 deletions
diff --git a/src/tool_cfgable.h b/src/tool_cfgable.h
index efbba0f2f..08da30a24 100644
--- a/src/tool_cfgable.h
+++ b/src/tool_cfgable.h
@@ -100,7 +100,6 @@ struct OperationConfig {
bool netrc_opt;
bool netrc;
char *netrc_file;
- bool noprogress; /* don't show progress meter, --silent given */
bool isatty; /* updated internally only if output is a tty */
struct getout *url_list; /* point to the first node */
struct getout *url_last; /* point to the last/current node */
@@ -122,7 +121,6 @@ struct OperationConfig {
char *customrequest;
char *krblevel;
long httpversion;
- int progressmode; /* CURL_PROGRESS_BAR or CURL_PROGRESS_STATS */
bool nobuffer;
bool readbusy; /* set when reading input returns EAGAIN */
bool globoff;
@@ -218,6 +216,7 @@ struct GlobalConfig {
0 => -s is used to NOT show errors
1 => -S has been used to show errors */
bool mute; /* don't show messages, --silent given */
+ bool noprogress; /* don't show progress bar --silent given */
FILE *errors; /* Error stream, defaults to stderr */
bool errors_fopened; /* Whether error stream isn't stderr */
char *trace_dump; /* file to dump the network trace to */
@@ -225,6 +224,7 @@ struct GlobalConfig {
bool trace_fopened;
trace tracetype;
bool tracetime; /* include timestamp? */
+ int progressmode; /* CURL_PROGRESS_BAR / CURL_PROGRESS_STATS */
struct OperationConfig *first;
struct OperationConfig *current;
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index c6377ed60..208d5aac7 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -983,9 +983,9 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
break;
case '#': /* --progress-bar */
if(toggle)
- config->progressmode = CURL_PROGRESS_BAR;
+ global->progressmode = CURL_PROGRESS_BAR;
else
- config->progressmode = CURL_PROGRESS_STATS;
+ global->progressmode = CURL_PROGRESS_STATS;
break;
case ':': /* --next */
return PARAM_NEXT_OPERATION;
@@ -1619,9 +1619,9 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
case 's':
/* don't show progress meter, don't show errors : */
if(toggle)
- global->mute = config->noprogress = TRUE;
+ global->mute = global->noprogress = TRUE;
else
- global->mute = config->noprogress = FALSE;
+ global->mute = global->noprogress = FALSE;
if(global->showerror < 0)
/* if still on the default value, set showerror to the reverse of
toggle. This is to allow -S and -s to be used in an independent
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 9683f3d91..2eeb51acf 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -345,7 +345,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
}
/* save the values of noprogress and isatty to restore them later on */
- orig_noprogress = config->noprogress;
+ orig_noprogress = global->noprogress;
orig_isatty = config->isatty;
/*
@@ -741,15 +741,15 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(uploadfile && config->resume_from_current)
config->resume_from = -1; /* -1 will then force get-it-yourself */
- if(output_expected(this_url, uploadfile)
- && outs.stream && isatty(fileno(outs.stream)))
+ if(output_expected(this_url, uploadfile) && outs.stream &&
+ isatty(fileno(outs.stream)))
/* we send the output to a tty, therefore we switch off the progress
meter */
- config->noprogress = config->isatty = TRUE;
+ global->noprogress = config->isatty = TRUE;
else {
/* progress meter is per download, so restore config
values */
- config->noprogress = orig_noprogress;
+ global->noprogress = orig_noprogress;
config->isatty = orig_isatty;
}
@@ -851,7 +851,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
if(uploadfilesize != -1)
my_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize);
my_setopt_str(curl, CURLOPT_URL, this_url); /* what to fetch */
- my_setopt(curl, CURLOPT_NOPROGRESS, config->noprogress?1L:0L);
+ my_setopt(curl, CURLOPT_NOPROGRESS, global->noprogress?1L:0L);
if(config->no_body) {
my_setopt(curl, CURLOPT_NOBODY, 1L);
my_setopt(curl, CURLOPT_HEADER, 1L);
@@ -1105,8 +1105,8 @@ static CURLcode operate_do(struct GlobalConfig *global,
my_setopt_str(curl, CURLOPT_KRBLEVEL, config->krblevel);
progressbarinit(&progressbar, config);
- if((config->progressmode == CURL_PROGRESS_BAR) &&
- !config->noprogress && !global->mute) {
+ if((global->progressmode == CURL_PROGRESS_BAR) &&
+ !global->noprogress && !global->mute) {
/* we want the alternative style, then we have to implement it
ourselves! */
my_setopt(curl, CURLOPT_XFERINFOFUNCTION, tool_progress_cb);
@@ -1533,7 +1533,7 @@ static CURLcode operate_do(struct GlobalConfig *global,
}
- if((config->progressmode == CURL_PROGRESS_BAR) &&
+ if((global->progressmode == CURL_PROGRESS_BAR) &&
progressbar.calls)
/* if the custom progress bar has been displayed, we output a
newline here */