make --version exit immediately after (short) version info

This commit is contained in:
Enno Rehling 2017-03-28 16:01:10 +02:00
parent 75049d3bbc
commit d959fe657c
1 changed files with 10 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/*
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
Copyright (c) 1998-2017, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
@ -165,7 +165,7 @@ static int verbosity_to_flags(int verbosity) {
return flags;
}
static int parse_args(int argc, char **argv, int *exitcode)
static int parse_args(int argc, char **argv)
{
int i;
int log_stderr = LOG_CPERROR;
@ -178,10 +178,10 @@ static int parse_args(int argc, char **argv, int *exitcode)
}
else if (argi[1] == '-') { /* long format */
if (strcmp(argi + 2, "version") == 0) {
printf("\n%s PBEM host\n"
"Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %s\n\n",
game_name(), eressea_version());
printf("Eressea version %s, "
"Copyright (C) 2017 Enno Rehling et al.\n",
eressea_version());
return 1;
#ifdef USE_CURSES
}
else if (strcmp(argi + 2, "color") == 0) {
@ -229,7 +229,6 @@ static int parse_args(int argc, char **argv, int *exitcode)
usage(argv[0], NULL);
return 1;
default:
*exitcode = -1;
usage(argv[0], argi);
return 1;
}
@ -300,8 +299,10 @@ int main(int argc, char **argv)
dictionary *d = 0;
setup_signal_handler();
/* parse arguments again, to override ini file */
parse_args(argc, argv, &err);
err = parse_args(argc, argv);
if (err!=0) {
return (err>0) ? 0 : err;
}
d = parse_config(inifile);
if (!d) {
log_error("could not open ini configuration %s\n", inifile);