mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
made -w support -w@[file] and -w@- (for stdin)
This commit is contained in:
parent
ed1ad4c5e2
commit
d64b8cdf23
14
src/main.c
14
src/main.c
@ -654,6 +654,20 @@ static int getparameter(char *flag, /* f or -long-flag */
|
|||||||
return URG_FAILED_INIT;
|
return URG_FAILED_INIT;
|
||||||
case 'w':
|
case 'w':
|
||||||
/* get the output string */
|
/* get the output string */
|
||||||
|
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);
|
GetStr(&config->writeout, nextarg);
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
|
Loading…
Reference in New Issue
Block a user