implement -dumpversion for gcc compatibility
authorMatthias Braun <matze@braunis.de>
Tue, 20 Dec 2011 13:35:02 +0000 (14:35 +0100)
committerMatthias Braun <matze@braunis.de>
Thu, 22 Dec 2011 15:30:10 +0000 (16:30 +0100)
main.c

diff --git a/main.c b/main.c
index 1090cba..61566a4 100644 (file)
--- a/main.c
+++ b/main.c
@@ -550,6 +550,11 @@ static void print_cparser_version(void)
             "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
 }
 
+static void print_cparser_version_short(void)
+{
+       puts(cparser_REVISION);
+}
+
 static void print_help_basic(const char *argv0)
 {
        usage(argv0);
@@ -1486,6 +1491,11 @@ int main(int argc, char **argv)
                                        (fprintf(stderr, "warning: ignoring gcc option '%s'\n", arg), standard);
                        } else if (streq(option, "version")) {
                                print_cparser_version();
+                               return EXIT_SUCCESS;
+                       } else if (streq(option, "dumpversion")) {
+                               /* gcc compatibility option */
+                               print_cparser_version_short();
+                               return EXIT_SUCCESS;
                        } else if (strstart(option, "print-file-name=")) {
                                GET_ARG_AFTER(print_file_name_file, "-print-file-name=");
                        } else if (option[0] == '-') {