summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-03-01 22:44:46 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-03-01 22:44:46 +0000
commitd64b8cdf237b2221685de797563a0b39ed4acb7a (patch)
tree92854cc63cd5fab9a1fb3cc64803f7b2e14947ec
parented1ad4c5e25fcadfe737f1b559a329b64052834b (diff)
downloadcurl-d64b8cdf237b2221685de797563a0b39ed4acb7a.tar.gz
made -w support -w@[file] and -w@- (for stdin)
-rw-r--r--src/main.c16
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 */