curl: include libmetalink version in --version output

Closes #7112
This commit is contained in:
Daniel Stenberg 2021-05-21 15:39:30 +02:00
parent b4bed24459
commit e61d8e36d2
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -23,10 +23,14 @@
#if defined(HAVE_STRCASECMP) && defined(HAVE_STRINGS_H)
#include <strings.h>
#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);