diff options
author | Daniel Stenberg <daniel@haxx.se> | 2001-05-29 18:30:47 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2001-05-29 18:30:47 +0000 |
commit | 8b4809a89829d875d15b89b3f601738f33080df7 (patch) | |
tree | 954d18fa02eb54ebcf7fddcbeda6776e5238f1cd /src | |
parent | 88d14e96cad8b2a9e54267ed1340dacca7c2ed3f (diff) |
fixed the -# to write to the same as --stderr is set to
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c index 05921247d..cd01e0518 100644 --- a/src/main.c +++ b/src/main.c @@ -1293,6 +1293,7 @@ struct ProgressData { size_t prev; size_t point; int width; + FILE *out; /* where to write everything to */ }; int myprogress (void *clientp, @@ -1322,7 +1323,7 @@ int myprogress (void *clientp, int prevblock = bar->prev / 1024; int thisblock = bar->point / 1024; while ( thisblock > prevblock ) { - fprintf( stderr, "#" ); + fprintf( bar->out, "#" ); prevblock++; } } @@ -1338,14 +1339,16 @@ int myprogress (void *clientp, line[i] = '\0'; sprintf( format, "%%-%ds %%5.1f%%%%", barwidth ); sprintf( outline, format, line, percent ); - fprintf( stderr, "\r%s", outline ); + fprintf( bar->out, "\r%s", outline ); } bar->prev = bar->point; return 0; } -void progressbarinit(struct ProgressData *bar) +static +void progressbarinit(struct ProgressData *bar, + struct Configurable *config) { #ifdef __EMX__ /* 20000318 mgs */ @@ -1379,6 +1382,7 @@ void progressbarinit(struct ProgressData *bar) bar->width = scr_size[0] - 1; #endif + bar->out = config->errors; } void free_config_fields(struct Configurable *config) @@ -1832,7 +1836,7 @@ operate(struct Configurable *config, int argc, char *argv[]) !(config->conf&(CONF_NOPROGRESS|CONF_MUTE))) { /* we want the alternative style, then we have to implement it ourselves! */ - progressbarinit(&progressbar); + progressbarinit(&progressbar, config); curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, myprogress); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &progressbar); } |