1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Starting working on the '-w/--write-out' output format specifier, although

I didn't get that far! ;-)
I also made curl *not* prevent the progress meter even if the output is a tty
when your uploading (it is still done when downloading though). A HTTP POST
is in that sense seen as an upload. It seemed so confusing that ftp upload
doesn't display a progress meter by default.
This commit is contained in:
Daniel Stenberg 2000-02-16 00:05:26 +00:00
parent f4898981b0
commit 01865ec553

View File

@ -126,6 +126,7 @@ static void help(void)
" -U/--proxy-user <user:password> Specify Proxy authentication\n" " -U/--proxy-user <user:password> Specify Proxy authentication\n"
" -v/--verbose Makes the operation more talkative\n" " -v/--verbose Makes the operation more talkative\n"
" -V/--version Outputs version number then quits\n" " -V/--version Outputs version number then quits\n"
" -w/--write-out [format] What to output after completion\n"
" -x/--proxy <host> Use proxy. (Default port is 1080)\n" " -x/--proxy <host> Use proxy. (Default port is 1080)\n"
" -X/--request <command> Specific request command to use\n" " -X/--request <command> Specific request command to use\n"
" -y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n" " -y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n"
@ -177,6 +178,8 @@ struct Configurable {
char *customrequest; char *customrequest;
bool progressmode; bool progressmode;
char *writeout; /* %-styled format string to output */
FILE *errors; /* if stderr redirect is requested */ FILE *errors; /* if stderr redirect is requested */
struct curl_slist *quote; struct curl_slist *quote;
@ -302,6 +305,7 @@ static int getparameter(char *flag, /* f or -long-flag */
{"U", "proxy-user", TRUE}, {"U", "proxy-user", TRUE},
{"v", "verbose", FALSE}, {"v", "verbose", FALSE},
{"V", "version", FALSE}, {"V", "version", FALSE},
{"w", "write-out", TRUE},
{"x", "proxy", TRUE}, {"x", "proxy", TRUE},
{"X", "request", TRUE}, {"X", "request", TRUE},
{"X", "http-request", TRUE}, /* OBSOLETE VERSION */ {"X", "http-request", TRUE}, /* OBSOLETE VERSION */
@ -648,6 +652,10 @@ static int getparameter(char *flag, /* f or -long-flag */
case 'V': case 'V':
printf(CURL_ID "%s\n", curl_version()); printf(CURL_ID "%s\n", curl_version());
return URG_FAILED_INIT; return URG_FAILED_INIT;
case 'w':
/* get the output string */
GetStr(&config->writeout, nextarg);
break;
case 'x': case 'x':
/* proxy */ /* proxy */
if(!*nextarg) { if(!*nextarg) {
@ -1040,10 +1048,10 @@ int main(int argc, char *argv[])
headerfilep=stdout; headerfilep=stdout;
} }
/* This was previously done in urlget, but that was wrong place to do it */ if(outs.stream && isatty(fileno(outs.stream)) &&
if(outs.stream && isatty(fileno(outs.stream))) !(config.conf&(CONF_UPLOAD|CONF_HTTPPOST)))
/* we send the output to a tty, and therefor we switch off the progress /* we send the output to a tty and it isn't an upload operation, therefore
meter right away */ we switch off the progress meter */
config.conf |= CONF_NOPROGRESS; config.conf |= CONF_NOPROGRESS;
#ifdef GLOBURL #ifdef GLOBURL