unclear. Other programs only support -e. Remove -D.
(install_service): Remove argument datadir_set.
(main): New option -v.
(main): Exit successfully after -h.
(main): Don't print usage on unknown options, just point to -h.
(print_usage): Rewrite. Deprecate use of non-option arguments.
#define DEFAULT_SERVICE_NAME "Empire Server"
extern int install_service(char *program_name, char *service_name,
#define DEFAULT_SERVICE_NAME "Empire Server"
extern int install_service(char *program_name, char *service_name,
- int datadir_set, char *config_file);
extern int remove_service(char *service_name);
extern void WINAPI service_main(DWORD argc, LPTSTR *argv);
#endif
extern int remove_service(char *service_name);
extern void WINAPI service_main(DWORD argc, LPTSTR *argv);
#endif
.SH SYNOPSIS
.B emp_server
[
.SH SYNOPSIS
.B emp_server
[
-.BI \-dhps
-]
-[
-.BI \-D " datadir"
]
[
.BI \-e " configfile"
]
]
[
.BI \-e " configfile"
]
.br
.SH DESCRIPTION
.I emp_server
is a daemon which listens to the Empire port for players connecting to
.br
.SH DESCRIPTION
.I emp_server
is a daemon which listens to the Empire port for players connecting to
-the game. For more information on the game of Empire, see the
-.I info
+the game. For more information on the game of Empire, see the info
pages within the game.
.SH OPTIONS
.TP
pages within the game.
.SH OPTIONS
.TP
.I emp_server
from within a debugger.
.TP
.I emp_server
from within a debugger.
.TP
+.BI \-e " configfile"
+Use game configuration specification in
+.I configfile
+\&. By default, the file "econfig" in the data directory is used.
+.TP
-Help. Print a usage line showing the command line options.
+Help. Print brief usage information and exit.
.TP
.B \-p
Threading debug mode. Implies -d.
.TP
.B \-p
Threading debug mode. Implies -d.
.B \-s
Enable thread stack checking.
.TP
.B \-s
Enable thread stack checking.
.TP
-.BI \-D " datadir"
-causes the server to use the data files in
-.I datadir
-.TP
-.BI \-e " configfile"
-causes the server to use the game configuration specification in
-.I configfile
-(by default, the file "econfig" in the data directory is used)
-.TP
-.IR name
-This argument does nothing. It is used by scripts to locate the
-server to kill it.
+.B \-v
+Print version information and exit.
+.SH OPERANDS
+Operands are ignored for backward compatibility. Their use is
+deprecated.
.SH BUGS
Please report all bugs to the Wolfpack <wolfpack@wolfpackempire.com>
.SH AUTHORS
.SH BUGS
Please report all bugs to the Wolfpack <wolfpack@wolfpackempire.com>
.SH AUTHORS
-install_service(char *program_name, char *service_name, int datadir_set, char *config_file)
+install_service(char *program_name, char *service_name, char *config_file)
{
char strDir[1024];
HANDLE schSCManager,schService;
{
char strDir[1024];
HANDLE schSCManager,schService;
} else
strcpy(strDir, program_name);
} else
strcpy(strDir, program_name);
- if (datadir_set) {
- strcat(strDir, " -D ");
- strcat(strDir, datadir);
- }
if (config_file != NULL) {
strcat(strDir, " -e ");
strcat(strDir, config_file);
if (config_file != NULL) {
strcat(strDir, " -e ");
strcat(strDir, config_file);
#include "product.h"
#include "optlist.h"
#include "server.h"
#include "product.h"
#include "optlist.h"
#include "server.h"
#include "prototypes.h"
static void nullify_objects(void);
#include "prototypes.h"
static void nullify_objects(void);
static void
print_usage(char *program_name)
{
static void
print_usage(char *program_name)
{
-#if defined(_WIN32)
- printf("Usage: %s -i -I service_name -r -R service_name -D datadir -e config_file -d -p\n",
- program_name);
- printf("-i install service with the default name %s\n", DEFAULT_SERVICE_NAME);
- printf("-r remove service with the default name %s\n", DEFAULT_SERVICE_NAME);
-
-#else
- printf("Usage: %s -D datadir -e config_file -d -p -s\n", program_name);
- printf("-s stack check flag (include print flag)\n");
+ printf("Usage: %s [OPTION]...\n"
+ " -d debug mode\n"
+ " -e CONFIG-FILE configuration file\n"
+ " (default %s)\n"
+ " -h display this help and exit\n"
+#ifdef _WIN32
+ " -i install service `%s'\n"
+ " -I NAME install service NAME\n"
- printf("-p print flag\n");
- printf("-d debug mode\n");
+ " -p threading debug mode, implies -d\n"
+#ifdef _WIN32
+ " -r remove service `%s'\n"
+ " -R NAME remove service NAME\n"
+#endif
+ " -s enable stack checking\n"
+ " -v display version information and exit\n"
+ program_name, dflt_econfig
+#ifdef _WIN32
+ , DEFAULT_SERVICE_NAME, DEFAULT_SERVICE_NAME
+#endif
+ );
int install_service_set = 0;
char *service_name = NULL;
int remove_service_set = 0;
int install_service_set = 0;
char *service_name = NULL;
int remove_service_set = 0;
#endif
char *config_file = NULL;
int op;
#endif
char *config_file = NULL;
int op;
#else
# define XOPTS
#endif
#else
# define XOPTS
#endif
- while ((op = getopt(argc, argv, "D:de:psh" XOPTS)) != EOF) {
+ while ((op = getopt(argc, argv, "de:hpsv" XOPTS)) != EOF) {
- case 'D':
- datadir = optarg;
-#if defined(_WIN32)
- datadir_set++;
-#endif
- break;
case 'p':
flags |= EMPTH_PRINT;
/* fall through */
case 'p':
flags |= EMPTH_PRINT;
/* fall through */
case 's':
flags |= EMPTH_STACKCHECK;
break;
case 's':
flags |= EMPTH_STACKCHECK;
break;
+ case 'v':
+ printf("Wolfpack Empire %d.%d.%d\n",
+ EMP_VERS_MAJOR, EMP_VERS_MINOR, EMP_VERS_PATCH);
+ return EXIT_SUCCESS;
+ return EXIT_SUCCESS;
+ default:
+ fprintf(stderr, "Try -h for help.\n");
return EXIT_FAILURE;
}
}
#if defined(_WIN32)
return EXIT_FAILURE;
}
}
#if defined(_WIN32)
- if ((debug || flags || datadir_set || config_file != NULL) &&
+ if ((debug || flags || config_file != NULL) &&
- fprintf(stderr, "Can't use -p, -s, -d, -D or -e with either "
+ fprintf(stderr, "Can't use -p, -s, -d or -e with either "
"-r or -R options\n");
exit(EXIT_FAILURE);
}
"-r or -R options\n");
exit(EXIT_FAILURE);
}
#if defined(_WIN32)
if (install_service_set)
#if defined(_WIN32)
if (install_service_set)
- return install_service(argv[0], service_name, datadir_set, config_file);
+ return install_service(argv[0], service_name, config_file);
#endif /* _WIN32 */
init_server();
#endif /* _WIN32 */
init_server();