From 044008f58f66d7a1b50c1dfc09cf8049e83a8227 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 26 Feb 2015 11:53:11 -0800 Subject: [PATCH] [master] version cleanup 4073. [cleanup] Add libjson-c version number reporting to "named -V"; normalize version number formatting. [RT #38056] --- CHANGES | 4 ++++ bin/named/main.c | 32 ++++++++++++++++++++++---------- bin/named/server.c | 6 ++++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index e878ff3c12..122035dbc6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +4073. [cleanup] Add libjson-c version number reporting to + "named -V"; normalize version number formatting. + [RT #38056] + 4072. [func] Add a --enable-querytrace configure switch for very verbose query tracelogging. [RT #37520] diff --git a/bin/named/main.c b/bin/named/main.c index 70fbb3a2fb..2ed94f8182 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -625,16 +625,16 @@ parse_command_line(int argc, char *argv[]) { ns_g_username = isc_commandline_argument; break; case 'v': - printf("%s %s", ns_g_product, ns_g_version); - if (*ns_g_description != 0) - printf(" %s", ns_g_description); - printf("\n"); + printf("%s %s%s%s \n", + ns_g_product, ns_g_version, + (*ns_g_description != '\0') ? " " : "", + ns_g_description, ns_g_srcid); exit(0); case 'V': - printf("%s %s", ns_g_product, ns_g_version); - if (*ns_g_description != 0) - printf(" %s", ns_g_description); - printf(" built by %s with %s\n", ns_g_srcid, + printf("%s %s%s%s \n", ns_g_product, ns_g_version, + (*ns_g_description != '\0') ? " " : "", + ns_g_description, ns_g_srcid); + printf("built by %s with %s\n", ns_g_builder, ns_g_configargs); #ifdef __clang__ printf("compiled by CLANG %s\n", __VERSION__); @@ -664,6 +664,12 @@ parse_command_line(int argc, char *argv[]) { LIBXML_DOTTED_VERSION); printf("linked to libxml2 version: %s\n", xmlParserVersion); +#endif +#ifdef HAVE_JSON + printf("compiled with libjson-c version: %s\n", + JSON_C_VERSION); + printf("linked to libjson-c version: %s\n", + json_c_version()); #endif exit(0); case 'x': @@ -992,12 +998,18 @@ setup(void) { isc_result_totext(result)); isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, - ISC_LOG_NOTICE, "starting %s %s%s", ns_g_product, - ns_g_version, saved_command_line); + ISC_LOG_NOTICE, "starting %s %s%s%s ", + ns_g_product, ns_g_version, + *ns_g_description ? " " : "", ns_g_description, + ns_g_srcid); isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, ISC_LOG_NOTICE, "built with %s", ns_g_configargs); + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, + ISC_LOG_NOTICE, "running as: %s%s", + program_name, saved_command_line); + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN, ISC_LOG_NOTICE, "----------------------------------------------------"); diff --git a/bin/named/server.c b/bin/named/server.c index 7a1a905ecc..0266522aa4 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -8342,8 +8342,10 @@ ns_server_status(ns_server_t *server, isc_buffer_t **text) { isc_time_formathttptimestamp(&ns_g_configtime, configtime, sizeof(configtime)); - snprintf(line, sizeof(line), "version: %s%s%s%s \n", - ns_g_version, ob, alt, cb, ns_g_srcid); + snprintf(line, sizeof(line), "version: %s %s%s%s %s%s%s\n", + ns_g_product, ns_g_version, + (*ns_g_description != '\0') ? " " : "", + ns_g_description, ns_g_srcid, ob, alt, cb); CHECK(putstr(text, line)); snprintf(line, sizeof(line), "boot time: %s\n", boottime);