From cc0c4dfb7ed8946fece6e5ca2ffd0e375268874d Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 1 Mar 2024 10:13:36 -0800 Subject: [PATCH] feat: add build id to asrestore version command --- src/backup_config.c | 2 +- src/restore_config.c | 31 +++++++++++++++++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/backup_config.c b/src/backup_config.c index 195fed0..0483057 100644 --- a/src/backup_config.c +++ b/src/backup_config.c @@ -41,7 +41,7 @@ extern char *aerospike_client_version; // Forward Declarations. // -static void print_version(void); +static void print_version(); static void usage(const char *name); //========================================================== diff --git a/src/restore_config.c b/src/restore_config.c index 2a998e9..c9e37c1 100644 --- a/src/restore_config.c +++ b/src/restore_config.c @@ -42,7 +42,7 @@ extern char *aerospike_client_version; // Forward Declarations. // -static void print_version(void); +static void print_version(); static void usage(const char* name); //========================================================== @@ -1057,12 +1057,31 @@ restore_config_from_cloud(const restore_config_t* conf) * Print the tool's version information. */ static void -print_version(void) +print_version() { - fprintf(stdout, "Aerospike Restore Utility\n"); - fprintf(stdout, "Version %s\n", TOOL_VERSION); - fprintf(stdout, "C Client Version %s\n", aerospike_client_version); - fprintf(stdout, "Copyright 2015-2021 Aerospike. All rights reserved.\n"); + char* build = NULL; + char* version_cpy = strdup(TOOL_VERSION); + char* token = strtok(version_cpy, "-"); + char* version = token; + + token = strtok(NULL, "-"); + + while (token != NULL) { + token = strtok(NULL, "-"); + + if (token != NULL) { + build = token; + } + } + + fprintf(stdout, "Aerospike Restore\n"); + fprintf(stdout, "Version %s\n", version); + + if (build != NULL) { + fprintf(stdout, "Build %s\n", build); + } + + free(version_cpy); } /*