From d64b8cdf237b2221685de797563a0b39ed4acb7a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 1 Mar 2000 22:44:46 +0000 Subject: made -w support -w@[file] and -w@- (for stdin) --- src/main.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 19802877b..5814efeb2 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 */ -- cgit v1.2.3