made -w support -w@[file] and -w@- (for stdin)

This commit is contained in:
Daniel Stenberg 2000-03-01 22:44:46 +00:00
parent ed1ad4c5e2
commit d64b8cdf23
1 changed files with 15 additions and 1 deletions

View File

@ -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 */