]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
--version
authorWolfgang (Blub) Bumiller <blub@speed.at>
Mon, 17 Dec 2012 15:14:39 +0000 (16:14 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Mon, 17 Dec 2012 15:14:39 +0000 (16:14 +0100)
main.c

diff --git a/main.c b/main.c
index 2043f7c98019be485eb7e902d1fab01d5db7cbfc..ca8ff42da2e928f4f1e7488dc1ec45368135f9dc 100644 (file)
--- a/main.c
+++ b/main.c
@@ -45,6 +45,16 @@ static ppitem  *ppems = NULL;
 
 static const char *app_name;
 
+static void version() {
+    con_out("GMQCC %d.%d.%d Built %s %s\n",
+        GMQCC_VERSION_MINOR,
+        GMQCC_VERSION_MAJOR,
+        GMQCC_VERSION_PATCH,
+        __DATE__,
+        __TIME__
+    );
+}
+
 static int usage() {
     con_out("usage: %s [options] [files...]", app_name);
     con_out("options:\n"
@@ -289,13 +299,7 @@ static bool options_parse(int argc, char **argv) {
                     /* break; never reached because of exit(0) */
 
                 case 'v':
-                     con_out("GMQCC %d.%d.%d Built %s %s\n",
-                        GMQCC_VERSION_MINOR,
-                        GMQCC_VERSION_MAJOR,
-                        GMQCC_VERSION_PATCH,
-                        __DATE__,
-                        __TIME__
-                    );
+                    version();
                     exit(0);
 
                 case 'E':
@@ -447,6 +451,10 @@ static bool options_parse(int argc, char **argv) {
                         usage();
                         exit(0);
                     }
+                    else if (!strcmp(argv[0]+2, "version")) {
+                        version();
+                        exit(0);
+                    }
                     else {
             /* All long options with arguments */
                         if (options_long_witharg("output", &argc, &argv, &argarg)) {