]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Consistently print version numbers to stdout
authorTony Finch <fanf@isc.org>
Mon, 7 Mar 2022 17:07:45 +0000 (17:07 +0000)
committerTony Finch <fanf@isc.org>
Wed, 9 Mar 2022 17:37:07 +0000 (17:37 +0000)
Since the user asked for the version number it is logical to make it a
non-error, i.e. print to stdout (not stderr) and exit(0).

Closes #3189

CHANGES
bin/delv/delv.c
bin/dig/dig.c
bin/dig/host.c
bin/dig/nslookup.c
bin/dnssec/dnssectool.c
bin/nsupdate/nsupdate.c
bin/tools/mdig.c

diff --git a/CHANGES b/CHANGES
index 3a2ee1217f1c74a91e87a7829b9b92622c481894..5e1e313964ea72f113393e23a1dbfed878f23c91 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+5827.  [cleanup]       The command-line utilities printed their version numbers
+                       inconsistently; they all now print to stdout. (They are
+                       still inconsistent abotut whether you use `-v` or `-V`
+                       to request the version). [GL #3189]
+
 5826.  [cleanup]       Stop dig from complaining about lack of IDN support when
                        the user asks for no IDN translation. [GL #3188]
 
index e98c551bbdccbe1290433be6b12c6681da55d2c9..be77cb1f53815c3f51ad41a3b5b58d53948e814a 100644 (file)
@@ -1334,7 +1334,7 @@ dash_option(char *option, char *next, bool *open_type_class) {
                        /* handled in preparse_args() */
                        break;
                case 'v':
-                       fprintf(stderr, "delv %s\n", PACKAGE_VERSION);
+                       printf("delv %s\n", PACKAGE_VERSION);
                        exit(0);
                /* NOTREACHED */
                default:
index 756d38b0e83d572e475e2dc4f814b9fefeae7bda..fbaf7e1d230f4af6d62dcf4a7c78abce5b5de1ae 100644 (file)
@@ -125,12 +125,6 @@ usage(void) {
 }
 #endif /* if TARGET_OS_IPHONE */
 
-/*% version */
-static void
-version(void) {
-       fprintf(stderr, "DiG %s\n", PACKAGE_VERSION);
-}
-
 /*% help */
 static void
 help(void) {
@@ -2164,7 +2158,7 @@ dash_option(char *option, char *next, dig_lookup_t **lookup,
                        (*lookup)->use_usec = true;
                        break;
                case 'v':
-                       version();
+                       printf("DiG %s\n", PACKAGE_VERSION);
                        exit(0);
                        break;
                }
index bfc54c646a4ff1aead05445b6bdcb42b687bd311..775cddf37ebb84c40258c4553ea4efbeecb07d56 100644 (file)
@@ -584,12 +584,6 @@ printmessage(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg,
 
 static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:";
 
-/*% version */
-static void
-version(void) {
-       fprintf(stderr, "host %s\n", PACKAGE_VERSION);
-}
-
 static void
 pre_parse_args(int argc, char **argv) {
        int c;
@@ -663,7 +657,7 @@ pre_parse_args(int argc, char **argv) {
                case 'v':
                        break;
                case 'V':
-                       version();
+                       printf("host %s\n", PACKAGE_VERSION);
                        exit(0);
                        break;
                case 'w':
index d5ce6f79008b7d6065496cce1b4cc16e41163726..742bb7851a5df9f92dea8020fa1dcb87f5fc86ee 100644 (file)
@@ -612,11 +612,6 @@ set_ndots(const char *value) {
        }
 }
 
-static void
-version(void) {
-       fprintf(stderr, "nslookup %s\n", PACKAGE_VERSION);
-}
-
 static void
 setoption(char *opt) {
        size_t l = strlen(opt);
@@ -880,7 +875,7 @@ parse_args(int argc, char **argv) {
                debug("main parsing %s", argv[0]);
                if (argv[0][0] == '-') {
                        if (strncasecmp(argv[0], "-ver", 4) == 0) {
-                               version();
+                               printf("nslookup %s\n", PACKAGE_VERSION);
                                exit(0);
                        } else if (argv[0][1] != 0) {
                                setoption(&argv[0][1]);
index 5908aa7df5aa982df9d5dd1f7edb09ec38fb7ba8..38e21c7b7642300d84089b81374adb36a2780ffd 100644 (file)
@@ -111,7 +111,7 @@ vbprintf(int level, const char *fmt, ...) {
 
 void
 version(const char *name) {
-       fprintf(stderr, "%s %s\n", name, PACKAGE_VERSION);
+       printf("%s %s\n", name, PACKAGE_VERSION);
        exit(0);
 }
 
index b0af713923a8053708d7148d533d840b559e28ee..7b6b4f8d5bbbf3575012918cae01c40325f1f0ca 100644 (file)
@@ -976,11 +976,6 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr,
        return (count);
 }
 
-static void
-version(void) {
-       fprintf(stderr, "nsupdate %s\n", PACKAGE_VERSION);
-}
-
 #define PARSE_ARGS_FMT "46C:dDghilL:Mok:p:Pr:R:t:Tu:vVy:"
 
 static void
@@ -1055,7 +1050,7 @@ pre_parse_args(int argc, char **argv) {
                        break;
 
                case 'V':
-                       version();
+                       printf("nsupdate %s\n", PACKAGE_VERSION);
                        doexit = true;
                        break;
 
index 4da54e15ee15e272736e9110eb5a2a06dd0c8607..a8dd85da38c093f573740246bb259ceb0a6660b1 100644 (file)
@@ -1726,7 +1726,7 @@ dash_option(const char *option, char *next, struct query *query, bool global,
                         */
                        break;
                case 'v':
-                       fprintf(stderr, "mDiG %s\n", PACKAGE_VERSION);
+                       printf("mDiG %s\n", PACKAGE_VERSION);
                        exit(0);
                        break;
                }