]> git.draconx.ca Git - gob-dx.git/commitdiff
Improve --version output.
authorNick Bowler <nbowler@draconx.ca>
Tue, 11 Feb 2020 01:37:12 +0000 (20:37 -0500)
committerNick Bowler <nbowler@draconx.ca>
Fri, 14 Feb 2020 05:27:12 +0000 (00:27 -0500)
A program's version text, when requested by the user, is not an error
message.  Kind of silly to direct it to the standard error stream.

Adjust the program so that version text goes to standard output, and
format the message to be consistent with the GNU coding standards.

configure.ac
src/main.c
tests/options.at

index 3632fb15767e4e5fff09dd2e20467d5d60be7a33..0fd20f7a406292d5d34cf1a2903a54705ea3c91a 100644 (file)
@@ -6,7 +6,7 @@ dnl License GPLv2+: GNU General Public License version 2 or any later version.
 dnl This is free software: you are free to change and redistribute it.
 dnl There is NO WARRANTY, to the extent permitted by law.
 
 dnl This is free software: you are free to change and redistribute it.
 dnl There is NO WARRANTY, to the extent permitted by law.
 
-AC_INIT([gob-dx], [2.0.20a], [nbowler@draconx.ca])
+AC_INIT([GObject Builder], [2.0.20a], [nbowler@draconx.ca], [gob-dx])
 AC_CONFIG_SRCDIR([src/treefuncs.def])
 AC_CONFIG_HEADERS([config.h])
 
 AC_CONFIG_SRCDIR([src/treefuncs.def])
 AC_CONFIG_HEADERS([config.h])
 
index 60c128aac53e8cae755deccd9c220df0d9a23546..b0e750556949761c3491ef2a97df7ebd63b6b2ab 100644 (file)
@@ -4520,6 +4520,18 @@ generate_outfiles(void)
        print_header_postfixes();
 }
 
        print_header_postfixes();
 }
 
+static void print_version(void)
+{
+       printf("%s (%s) %s\n", PACKAGE_NAME, PACKAGE_TARNAME, PACKAGE_VERSION);
+       putchar('\n');
+       puts("Copyright (C) 2013 George (Jiri) Lebl et al.");
+       puts("Copyright (C) 2020 Nick Bowler");
+       puts("License GPLv2+: GNU GPL version 2 or later <https://gnu.org/licenses/gpl.html>.");
+       puts("This is free software: you are free to change and redistribute it.");
+       puts("There is NO WARRANTY, to the extent permitted by law.");
+
+}
+
 static void print_usage(FILE *f)
 {
        fprintf(f, "Usage: %s [options] file.gob\n", g_get_prgname());
 static void print_usage(FILE *f)
 {
        fprintf(f, "Usage: %s [options] file.gob\n", g_get_prgname());
@@ -4644,7 +4656,7 @@ parse_options(int argc, char *argv[])
                        print_help();
                        exit(0);
                } else if(strcmp(argv[i], "--version")==0) {
                        print_help();
                        exit(0);
                } else if(strcmp(argv[i], "--version")==0) {
-                       fprintf(stderr, "Gob version %s\n", VERSION);
+                       print_version();
                        exit(0);
                } else if(strcmp(argv[i], "--exit-on-warn")==0) {
                        exit_on_warn = TRUE;
                        exit(0);
                } else if(strcmp(argv[i], "--exit-on-warn")==0) {
                        exit_on_warn = TRUE;
index 22e96091b01cc048f5e9b9f3e0c0ca056a84438b..30be9e21fcdf45dc7cae0f6ee06d12538962ff73 100644 (file)
@@ -17,8 +17,6 @@ dnl standard output, and contains the correct version number.
 AT_SETUP([--version option])
 AT_KEYWORDS([option])dnl
 
 AT_SETUP([--version option])
 AT_KEYWORDS([option])dnl
 
-# Currently prints to standard error :(
-AT_XFAIL_IF([:])
 AT_CHECK([gob2 invalid-file.gob --version --invalid-option], [0], [stdout])
 AT_CHECK([awk 'NR == 1 { print $NF }' stdout], [0], [AT_PACKAGE_VERSION
 ])
 AT_CHECK([gob2 invalid-file.gob --version --invalid-option], [0], [stdout])
 AT_CHECK([awk 'NR == 1 { print $NF }' stdout], [0], [AT_PACKAGE_VERSION
 ])