From: Daniel Stenberg Date: Wed, 1 Mar 2000 22:44:46 +0000 (+0000) Subject: made -w support -w@[file] and -w@- (for stdin) X-Git-Tag: curl-6_5~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d64b8cdf237b2221685de797563a0b39ed4acb7a;p=thirdparty%2Fcurl.git made -w support -w@[file] and -w@- (for stdin) --- diff --git a/src/main.c b/src/main.c index 19802877bb..5814efeb24 100644 --- a/src/main.c +++ b/src/main.c @@ -654,7 +654,21 @@ static int getparameter(char *flag, /* f or -long-flag */ return URG_FAILED_INIT; case 'w': /* get the output string */ - GetStr(&config->writeout, nextarg); + if('@' == *nextarg) { + /* the data begins with a '@' letter, it means that a file name + or - (stdin) follows */ + FILE *file; + nextarg++; /* pass the @ */ + if(strequal("-", nextarg)) + file = stdin; + else + file = fopen(nextarg, "r"); + config->writeout = file2string(file); + if(file && (file != stdin)) + fclose(stdin); + } + else + GetStr(&config->writeout, nextarg); break; case 'x': /* proxy */