]> granicus.if.org Git - curl/commitdiff
made -w support -w@[file] and -w@- (for stdin)
authorDaniel Stenberg <daniel@haxx.se>
Wed, 1 Mar 2000 22:44:46 +0000 (22:44 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 1 Mar 2000 22:44:46 +0000 (22:44 +0000)
src/main.c

index 19802877bbfede9b1ae97f082ffa17b5f1e278c1..5814efeb241154bb3bbb2b25585f092e60b0a993 100644 (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 */