From: Wolfgang (Blub) Bumiller Date: Mon, 17 Dec 2012 15:14:39 +0000 (+0100) Subject: --version X-Git-Tag: 0.1.9~86 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=340de8379ac19913f2cb10a47162ee978960fc0f;p=xonotic%2Fgmqcc.git --version --- diff --git a/main.c b/main.c index 2043f7c..ca8ff42 100644 --- 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)) {