diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-03-01 22:44:46 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-03-01 22:44:46 +0000 |
commit | d64b8cdf237b2221685de797563a0b39ed4acb7a (patch) | |
tree | 92854cc63cd5fab9a1fb3cc64803f7b2e14947ec /src | |
parent | ed1ad4c5e25fcadfe737f1b559a329b64052834b (diff) |
made -w support -w@[file] and -w@- (for stdin)
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 16 |
1 files changed, 15 insertions, 1 deletions
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 */ |