--version

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-12-17 16:14:39 +01:00
parent 08302ff32b
commit 340de8379a

22
main.c
View file

@ -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)) {