forked from github/server
make --version exit immediately after (short) version info
This commit is contained in:
parent
75049d3bbc
commit
d959fe657c
19
src/main.c
19
src/main.c
|
@ -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
|
Katja Zedel <katze@felidae.kn-bremen.de
|
||||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ static int verbosity_to_flags(int verbosity) {
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_args(int argc, char **argv, int *exitcode)
|
static int parse_args(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int log_stderr = LOG_CPERROR;
|
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 */
|
else if (argi[1] == '-') { /* long format */
|
||||||
if (strcmp(argi + 2, "version") == 0) {
|
if (strcmp(argi + 2, "version") == 0) {
|
||||||
printf("\n%s PBEM host\n"
|
printf("Eressea version %s, "
|
||||||
"Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
|
"Copyright (C) 2017 Enno Rehling et al.\n",
|
||||||
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %s\n\n",
|
eressea_version());
|
||||||
game_name(), eressea_version());
|
return 1;
|
||||||
#ifdef USE_CURSES
|
#ifdef USE_CURSES
|
||||||
}
|
}
|
||||||
else if (strcmp(argi + 2, "color") == 0) {
|
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);
|
usage(argv[0], NULL);
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
*exitcode = -1;
|
|
||||||
usage(argv[0], argi);
|
usage(argv[0], argi);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -300,8 +299,10 @@ int main(int argc, char **argv)
|
||||||
dictionary *d = 0;
|
dictionary *d = 0;
|
||||||
setup_signal_handler();
|
setup_signal_handler();
|
||||||
/* parse arguments again, to override ini file */
|
/* 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);
|
d = parse_config(inifile);
|
||||||
if (!d) {
|
if (!d) {
|
||||||
log_error("could not open ini configuration %s\n", inifile);
|
log_error("could not open ini configuration %s\n", inifile);
|
||||||
|
|
Loading…
Reference in New Issue