aboutsummaryrefslogtreecommitdiff
path: root/src/tool_writeout.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2018-10-08 23:54:01 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-11-07 11:09:55 +0100
commite431daf013ea04cb1a988a2009d820224ef5fb79 (patch)
treea6d402eb463c0db26424eb02be0954cd137dcd1b /src/tool_writeout.c
parent8a49b291cb2900f48927facae3cb170475a2558e (diff)
curl: add %{stderr} and %{stdout} for --write-out
Closes #3115
Diffstat (limited to 'src/tool_writeout.c')
-rw-r--r--src/tool_writeout.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tool_writeout.c b/src/tool_writeout.c
index ffe47c633..d394411b0 100644
--- a/src/tool_writeout.c
+++ b/src/tool_writeout.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -60,6 +60,8 @@ typedef enum {
VAR_LOCAL_PORT,
VAR_HTTP_VERSION,
VAR_SCHEME,
+ VAR_STDOUT,
+ VAR_STDERR,
VAR_NUM_OF_VARS /* must be the last */
} replaceid;
@@ -101,6 +103,8 @@ static const struct variable replacements[]={
{"local_port", VAR_LOCAL_PORT},
{"http_version", VAR_HTTP_VERSION},
{"scheme", VAR_SCHEME},
+ {"stdout", VAR_STDOUT},
+ {"stderr", VAR_STDERR},
{NULL, VAR_NONE}
};
@@ -320,6 +324,12 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
curl_easy_getinfo(curl, CURLINFO_SCHEME,
&stringp))
fprintf(stream, "%s", stringp);
+ /* FALLTHROUGH */
+ case VAR_STDOUT:
+ stream = stdout;
+ break;
+ case VAR_STDERR:
+ stream = stderr;
break;
default:
break;