]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Introduce `-V` option to print the version number and build options.
authorGeorge Thessalonikefs <george@nlnetlabs.nl>
Mon, 12 Aug 2019 15:52:43 +0000 (17:52 +0200)
committerGeorge Thessalonikefs <george@nlnetlabs.nl>
Mon, 12 Aug 2019 15:52:43 +0000 (17:52 +0200)
  Previously reported build options like linked libs and linked modules
  are now moved from `-h` to `-V` as well for consistency.
- PACKAGE_BUGREPORT now also includes link to GitHub issues.

config.h.in
configure.ac
daemon/unbound.c
doc/Changelog
doc/unbound.8.in

index 4d614c8383897796d1f678a37d812ff0c1d12592..1bfe4426d1dec678554898b71115702cf05bd883 100644 (file)
@@ -15,6 +15,9 @@
 /* Do sha512 definitions in config.h */
 #undef COMPAT_SHA512
 
+/* Command line arguments used with configure */
+#undef CONFCMDLINE
+
 /* Pathname to the Unbound configuration file */
 #undef CONFIGFILE
 
index 19cbf66100aa7309b27946c83299fddbcf80c84d..76ab6c1aa6adc05c6dfd8a97c53388cc88904b0c 100644 (file)
@@ -12,7 +12,7 @@ sinclude(dnscrypt/dnscrypt.m4)
 m4_define([VERSION_MAJOR],[1])
 m4_define([VERSION_MINOR],[9])
 m4_define([VERSION_MICRO],[3])
-AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl, unbound)
+AC_INIT(unbound, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), unbound-bugs@nlnetlabs.nl or https://github.com/NLnetLabs/unbound/issues, unbound)
 AC_SUBST(UNBOUND_VERSION_MAJOR, [VERSION_MAJOR])
 AC_SUBST(UNBOUND_VERSION_MINOR, [VERSION_MINOR])
 AC_SUBST(UNBOUND_VERSION_MICRO, [VERSION_MICRO])
@@ -112,6 +112,8 @@ AC_SUBST(LIBUNBOUND_CURRENT)
 AC_SUBST(LIBUNBOUND_REVISION)
 AC_SUBST(LIBUNBOUND_AGE)
 
+AC_DEFINE_UNQUOTED(CONFCMDLINE, "$@", [Command line arguments used with configure])
+
 CFLAGS="$CFLAGS"
 AC_AIX
 if test "$ac_cv_header_minix_config_h" = "yes"; then
index 6cc8225f5d183727fb41773368c789d16fef3501..f5d28bacbb261691acbcdadb490353e8b6238ea6 100644 (file)
 #  include "nss.h"
 #endif
 
-/** print usage. */
-static void usage(void)
+/** print build options. */
+static void
+print_build_options(void)
 {
        const char** m;
        const char *evnm="event", *evsys="", *evmethod="";
        time_t t;
        struct timeval now;
        struct ub_event_base* base;
-       printf("usage:  unbound [options]\n");
-       printf("        start unbound daemon DNS resolver.\n");
-       printf("-h      this help\n");
-       printf("-c file config file to read instead of %s\n", CONFIGFILE);
-       printf("        file format is described in unbound.conf(5).\n");
-       printf("-d      do not fork into the background.\n");
-       printf("-p      do not create a pidfile.\n");
-       printf("-v      verbose (more times to increase verbosity)\n");
-#ifdef UB_ON_WINDOWS
-       printf("-w opt  windows option: \n");
-       printf("        install, remove - manage the services entry\n");
-       printf("        service - used to start from services control panel\n");
-#endif
-       printf("Version %s\n", PACKAGE_VERSION);
+       printf("Version %s\n\n", PACKAGE_VERSION);
+       printf("Configure line: %s\n", CONFCMDLINE);
        base = ub_default_event_base(0,&t,&now);
        ub_get_event_sys(base, &evnm, &evsys, &evmethod);
-       printf("linked libs: %s %s (it uses %s), %s\n", 
+       printf("Linked libs: %s %s (it uses %s), %s\n",
                evnm, evsys, evmethod,
 #ifdef HAVE_SSL
 #  ifdef SSLEAY_VERSION
@@ -126,16 +115,39 @@ static void usage(void)
                "nettle"
 #endif
                );
-       printf("linked modules:");
+       printf("Linked modules:");
        for(m = module_list_avail(); *m; m++)
                printf(" %s", *m);
        printf("\n");
 #ifdef USE_DNSCRYPT
        printf("DNSCrypt feature available\n");
 #endif
+       ub_event_base_free(base);
+       printf("\nBSD licensed, see LICENSE in source package for details.\n");
+       printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
+}
+
+/** print usage. */
+static void
+usage(void)
+{
+       printf("usage:  unbound [options]\n");
+       printf("        start unbound daemon DNS resolver.\n");
+       printf("-h      this help.\n");
+       printf("-c file config file to read instead of %s\n", CONFIGFILE);
+       printf("        file format is described in unbound.conf(5).\n");
+       printf("-d      do not fork into the background.\n");
+       printf("-p      do not create a pidfile.\n");
+       printf("-v      verbose (more times to increase verbosity).\n");
+       printf("-V      show version number and build options.\n");
+#ifdef UB_ON_WINDOWS
+       printf("-w opt  windows option: \n");
+       printf("        install, remove - manage the services entry\n");
+       printf("        service - used to start from services control panel\n");
+#endif
+       printf("\nVersion %s\n", PACKAGE_VERSION);
        printf("BSD licensed, see LICENSE in source package for details.\n");
        printf("Report bugs to %s\n", PACKAGE_BUGREPORT);
-       ub_event_base_free(base);
 }
 
 #ifndef unbound_testbound
@@ -720,7 +732,7 @@ main(int argc, char* argv[])
        log_ident_default = strrchr(argv[0],'/')?strrchr(argv[0],'/')+1:argv[0];
        log_ident_set(log_ident_default);
        /* parse the options */
-       while( (c=getopt(argc, argv, "c:dhpvw:")) != -1) {
+       while( (c=getopt(argc, argv, "c:dhpvw:V")) != -1) {
                switch(c) {
                case 'c':
                        cfgfile = optarg;
@@ -741,6 +753,9 @@ main(int argc, char* argv[])
                case 'w':
                        winopt = optarg;
                        break;
+               case 'V':
+                       print_build_options();
+                       return 0;
                case '?':
                case 'h':
                default:
index 33c7fdfeae72f484d45afa3d4525fd108655a84a..acd030487542ac05c97d8d98eb8f37d427bbf024 100644 (file)
@@ -1,3 +1,9 @@
+12 August 2019: George
+       - Introduce `-V` option to print the version number and build options.
+         Previously reported build options like linked libs and linked modules
+         are now moved from `-h` to `-V` as well for consistency.
+       - PACKAGE_BUGREPORT now also includes link to GitHub issues.
+
 1 August 2019: Wouter
        - For #52 #53, second context does not close logfile override.
        - Fix #52 #53, fix for example fail program.
index cea3aef18dd77330a3f0cf2b3018ca4b455d80f7..6e28ea783142b69f5472e35fa6aaaed78c229353 100644 (file)
@@ -54,7 +54,7 @@ resolvers are using the same port number (53).
 The available options are:
 .TP
 .B \-h
-Show the version and commandline option help.
+Show the version number and commandline option help, and exit.
 .TP
 .B \-c\fI cfgfile
 Set the config file with settings for unbound to read instead of reading the
@@ -76,6 +76,9 @@ concurrently.
 .B \-v
 Increase verbosity. If given multiple times, more information is logged.
 This is in addition to the verbosity (if any) from the config file.
+.TP
+.B \-V
+Show the version number and build options, and exit.
 .SH "SEE ALSO"
 \fIunbound.conf\fR(5),
 \fIunbound\-checkconf\fR(8),