From: Daniel Stenberg Date: Fri, 21 May 2021 13:39:30 +0000 (+0200) Subject: curl: include libmetalink version in --version output X-Git-Tag: curl-7_77_0~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e61d8e36d261b2caa915543d0593faa576164cb1;p=thirdparty%2Fcurl.git curl: include libmetalink version in --version output Closes #7112 --- diff --git a/src/tool_help.c b/src/tool_help.c index 78c441e776..45f137f2ad 100644 --- a/src/tool_help.c +++ b/src/tool_help.c @@ -23,10 +23,14 @@ #if defined(HAVE_STRCASECMP) && defined(HAVE_STRINGS_H) #include #endif +#define ENABLE_CURLX_PRINTF +/* use our own printf() functions */ +#include "curlx.h" #include "tool_panykey.h" #include "tool_help.h" #include "tool_libinfo.h" +#include "tool_metalink.h" #include "tool_version.h" #include "memdebug.h" /* keep this as LAST include */ @@ -963,11 +967,27 @@ featcomp(const void *p1, const void *p2) #endif } +#ifdef USE_METALINK +static const char *metalnk_version(void) +{ + static char version[25]; + int major = 0; + int minor = 0; + int patch = 0; + metalink_get_version(&major, &minor, &patch); + msnprintf(version, sizeof(version), " libmetalink/%u.%u.%u", + major, minor, patch); + return version; +} +#else +#define metalnk_version() "" +#endif + void tool_version_info(void) { const char *const *proto; - printf(CURL_ID "%s\n", curl_version()); + printf(CURL_ID "%s%s\n", curl_version(), metalnk_version()); #ifdef CURL_PATCHSTAMP printf("Release-Date: %s, security patched: %s\n", LIBCURL_TIMESTAMP, CURL_PATCHSTAMP);