(daemon, daemonize): Rename to avoid name clash with BSD's daemon().
(daemonize): Supply missing declaration.
This commit is contained in:
parent
30f2b2c4ea
commit
84b8189c13
3 changed files with 9 additions and 11 deletions
|
@ -124,6 +124,7 @@ typedef short coord;
|
||||||
#define days(x) (60*60*24*(x))
|
#define days(x) (60*60*24*(x))
|
||||||
|
|
||||||
extern int debug;
|
extern int debug;
|
||||||
|
extern int daemonize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If EXPR is true, an internal error occured.
|
* If EXPR is true, an internal error occured.
|
||||||
|
|
|
@ -471,7 +471,7 @@ empth_exit(void)
|
||||||
if (pThread->bMainThread) {
|
if (pThread->bMainThread) {
|
||||||
/* The main line. Wait forever. */
|
/* The main line. Wait forever. */
|
||||||
while (1) {
|
while (1) {
|
||||||
if (daemon) {
|
if (daemonize) {
|
||||||
if (service_stopped())
|
if (service_stopped())
|
||||||
shutdwn(0);
|
shutdwn(0);
|
||||||
Sleep(3);
|
Sleep(3);
|
||||||
|
|
|
@ -76,13 +76,10 @@ static void loc_NTInit(void);
|
||||||
|
|
||||||
static int mainpid = 0;
|
static int mainpid = 0;
|
||||||
|
|
||||||
/*
|
/* Debugging? If yes call abort() on internal error. */
|
||||||
* Debugging?
|
|
||||||
* If yes, don't fork into background, don't catch certain signals,
|
|
||||||
* call abort() on internal error.
|
|
||||||
*/
|
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
int daemon = 1;
|
/* Run as daemon? If yes, detach from controlling terminal etc. */
|
||||||
|
int daemonize = 1;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_usage(char *program_name)
|
print_usage(char *program_name)
|
||||||
|
@ -129,7 +126,7 @@ main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
debug++;
|
debug++;
|
||||||
daemon = 0;
|
daemonize = 0;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
config_file = optarg;
|
config_file = optarg;
|
||||||
|
@ -204,7 +201,7 @@ main(int argc, char **argv)
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
if (daemon != 0) {
|
if (daemonize != 0) {
|
||||||
SERVICE_TABLE_ENTRY DispatchTable[]={{"Empire Server", service_main},{NULL, NULL}};
|
SERVICE_TABLE_ENTRY DispatchTable[]={{"Empire Server", service_main},{NULL, NULL}};
|
||||||
if (StartServiceCtrlDispatcher(DispatchTable))
|
if (StartServiceCtrlDispatcher(DispatchTable))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -220,12 +217,12 @@ main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
daemon = 0;
|
daemonize = 0;
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
init_server(flags);
|
init_server(flags);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (daemon != 0 && flags == 0)
|
if (daemonize != 0 && flags == 0)
|
||||||
disassoc();
|
disassoc();
|
||||||
#endif
|
#endif
|
||||||
start_server(flags);
|
start_server(flags);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue