summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-06-21 01:00:53 +0900
committerYang Tse <yangsita@gmail.com>2012-06-21 03:35:52 +0200
commit7561a0fc834c435c1d8a32046701d7c90d61287e (patch)
treee913966822bd65d33aa4f11b741f54d59fd21833 /src
parent196c8242caa30472564290f1c89e7e19d2f04453 (diff)
downloadcurl-7561a0fc834c435c1d8a32046701d7c90d61287e.tar.gz
curl: Restore noprogress and isatty config values.
The noprogress and isatty in Configurable are global, in a sense that they persist in one curl invocation. Currently once one download writes its response data to tty, they are set to FALSE and they are not restored on successive downloads. This change first backups the current noprogress and isatty, and restores them when download does not write its data to tty.
Diffstat (limited to 'src')
-rw-r--r--src/tool_operate.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 6d02fb667..4b9c42dc7 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -140,6 +140,9 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
int res = 0;
int i;
+ bool orig_noprogress = config->noprogress;
+ bool orig_isatty = config->isatty;
+
errorbuffer[0] = '\0';
/* default headers output stream is stdout */
memset(&hdrcbdata, 0, sizeof(struct HdrCbData));
@@ -223,7 +226,7 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
('-' == argv[i][0])) {
char *nextarg;
bool passarg;
- char *origopt = argv[i];
+ char *orig_opt = argv[i];
char *flag = argv[i];
@@ -239,7 +242,7 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
int retval = CURLE_OK;
if(res != PARAM_HELP_REQUESTED) {
const char *reason = param2text(res);
- helpf(config->errors, "option %s: %s\n", origopt, reason);
+ helpf(config->errors, "option %s: %s\n", orig_opt, reason);
retval = CURLE_FAILED_INIT;
}
res = retval;
@@ -766,6 +769,12 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[])
/* we send the output to a tty, therefore we switch off the progress
meter */
config->noprogress = config->isatty = TRUE;
+ else {
+ /* progress meter is per download, so restore config
+ values */
+ config->noprogress = orig_noprogress;
+ config->isatty = orig_isatty;
+ }
if(urlnum > 1 && !(config->mute)) {
fprintf(config->errors, "\n[%d/%d]: %s --> %s\n",