From 3939741d657aa755440d3baf205879e5cb3b2e6e Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 16 Mar 2005 18:41:44 +0000 Subject: [PATCH] (main): Fix -p to imply -d as documented, not just !daemonize. (main): -s no longer implies -p. (main) [_WIN32]: Recognize -s. ntthread.c ignores it. --- man/emp_server.6 | 11 ++++------- src/server/main.c | 26 ++++++++++++-------------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/man/emp_server.6 b/man/emp_server.6 index f9beb9242..782a009bc 100644 --- a/man/emp_server.6 +++ b/man/emp_server.6 @@ -27,8 +27,8 @@ pages within the game. .TP .B \-d Debug mode. This will prevent the server from forking itself into the -background. It will also make the server abort when it detects an -internal error. You normally want to use this flag if you are running +background. It will also make it abort when it detects an internal +error. You normally want to use this flag if you are running .I emp_server from within a debugger. .TP @@ -36,13 +36,10 @@ from within a debugger. Help. Print a usage line showing the command line options. .TP .B \-p -Lwp Print mode. This is used for debugging lwp-threads. -This option automatically sets -d option. +Threading debug mode. Implies -d. .TP .B \-s -Lwp stack check mode. This will report if any of the lwp thread stack -spaces overflow. It forces lwp print mode on. -This option automatically sets -d option. +Enable thread stack checking. .TP .BI \-D " datadir" causes the server to use the data files in diff --git a/src/server/main.c b/src/server/main.c index b711b9f1e..6d125c204 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -113,11 +113,12 @@ main(int argc, char **argv) char *config_file = NULL; int op; -#if defined(_WIN32) - while ((op = getopt(argc, argv, "D:de:iI:rR:hp")) != EOF) { +#ifdef _WIN32 +# define XOPTS "iI:rR:" #else - while ((op = getopt(argc, argv, "D:de:psh")) != EOF) { +# define XOPTS #endif + while ((op = getopt(argc, argv, "D:de:psh" XOPTS)) != EOF) { switch (op) { case 'D': datadir = optarg; @@ -125,17 +126,16 @@ main(int argc, char **argv) datadir_set++; #endif break; + case 'p': + flags |= EMPTH_PRINT; + /* fall through */ case 'd': - debug++; + debug = 1; daemonize = 0; break; case 'e': config_file = optarg; break; - case 'p': - flags |= EMPTH_PRINT; - daemonize = 0; - break; #if defined(_WIN32) case 'I': service_name = optarg; @@ -153,12 +153,10 @@ main(int argc, char **argv) case 'r': remove_service_set++; break; -#else +#endif case 's': - flags |= EMPTH_PRINT | EMPTH_STACKCHECK; - daemonize = 0; + flags |= EMPTH_STACKCHECK; break; -#endif case 'h': default: print_usage(argv[0]); @@ -169,12 +167,12 @@ main(int argc, char **argv) #if defined(_WIN32) if ((debug || flags || datadir_set || config_file != NULL) && remove_service_set) { - fprintf(stderr, "Can't use -p, -d, -D or -e with either " + fprintf(stderr, "Can't use -p, -s, -d, -D or -e with either " "-r or -R options\n"); exit(EXIT_FAILURE); } if ((debug || flags) && install_service_set) { - fprintf(stderr, "Can't use -d or -p with either " + fprintf(stderr, "Can't use -d, -p or -s with either " "-i or -I options\n"); exit(EXIT_FAILURE); } -- 2.43.0