summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMathias Gumz <mg@2hoch5.com>2020-02-01 18:55:24 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-03-17 15:01:28 +0100
commit04c03416e68fd635a15cae8201872f5c29fdcca8 (patch)
tree6b10d49ed62cd8a23b4a254e144c9b90321cfc7b /lib
parentd83402813b624d9067416bea2e7feb70a358cf65 (diff)
downloadcurl-04c03416e68fd635a15cae8201872f5c29fdcca8.tar.gz
writeout: support to generate JSON output
This commit adds support to generate JSON via the writeout feature: -w "%{json}" It leverages the existing infrastructure as much as possible. Thus, generating the JSON on STDERR is possible by: -w "%{stderr}%{json}" This implements a variant of https://github.com/curl/curl/wiki/JSON#--write-out-json. Closes #4870
Diffstat (limited to 'lib')
-rw-r--r--lib/version.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/version.c b/lib/version.c
index 8170106ee..c7fe42a07 100644
--- a/lib/version.c
+++ b/lib/version.c
@@ -127,6 +127,16 @@ char *curl_version(void)
int i = 0;
int j;
+#ifdef DEBUGBUILD
+ /* Override version string when environment variable CURL_VERSION is set */
+ const char *debugversion = getenv("CURL_VERSION");
+ if(debugversion) {
+ strncpy(out, debugversion, sizeof(out)-1);
+ out[sizeof(out)-1] = '\0';
+ return out;
+ }
+#endif
+
src[i++] = LIBCURL_NAME "/" LIBCURL_VERSION;
#ifdef USE_SSL
Curl_ssl_version(ssl_version, sizeof(ssl_version));