80 |
|
unsigned int dorehash; |
81 |
|
unsigned int doremotd; |
82 |
|
|
83 |
+ |
static int printVersion; |
84 |
+ |
|
85 |
+ |
static struct lgetopt myopts[] = |
86 |
+ |
{ |
87 |
+ |
{ "configfile", &ConfigGeneral.configfile, |
88 |
+ |
STRING, "File to use for ircd.conf" }, |
89 |
+ |
{ "klinefile", &ConfigGeneral.klinefile, |
90 |
+ |
STRING, "File to use for kline database" }, |
91 |
+ |
{ "dlinefile", &ConfigGeneral.dlinefile, |
92 |
+ |
STRING, "File to use for dline database" }, |
93 |
+ |
{ "xlinefile", &ConfigGeneral.xlinefile, |
94 |
+ |
STRING, "File to use for xline database" }, |
95 |
+ |
{ "resvfile", &ConfigGeneral.resvfile, |
96 |
+ |
STRING, "File to use for resv database" }, |
97 |
+ |
{ "logfile", &logFileName, |
98 |
+ |
STRING, "File to use for ircd.log" }, |
99 |
+ |
{ "pidfile", &pidFileName, |
100 |
+ |
STRING, "File to use for process ID" }, |
101 |
+ |
{ "foreground", &server_state.foreground, |
102 |
+ |
YESNO, "Run in foreground (don't detach)" }, |
103 |
+ |
{ "version", &printVersion, |
104 |
+ |
YESNO, "Print version and exit" }, |
105 |
+ |
{ "help", NULL, USAGE, "Print this text" }, |
106 |
+ |
{ NULL, NULL, STRING, NULL }, |
107 |
+ |
}; |
108 |
+ |
|
109 |
|
static struct event event_cleanup_tklines = |
110 |
|
{ |
111 |
|
.name = "cleanup_tklines", |
141 |
|
}; |
142 |
|
|
143 |
|
|
118 |
– |
/* |
119 |
– |
* print_startup - print startup information |
120 |
– |
*/ |
121 |
– |
static void |
122 |
– |
print_startup(int pid) |
123 |
– |
{ |
124 |
– |
printf("ircd: version %s(%s)\n", ircd_version, serno); |
125 |
– |
printf("ircd: pid %d\n", pid); |
126 |
– |
printf("ircd: running in %s mode from %s\n", !server_state.foreground ? "background" |
127 |
– |
: "foreground", ConfigGeneral.dpath); |
128 |
– |
} |
129 |
– |
|
130 |
– |
static void |
131 |
– |
make_daemon(void) |
132 |
– |
{ |
133 |
– |
int pid; |
134 |
– |
|
135 |
– |
if ((pid = fork()) < 0) |
136 |
– |
{ |
137 |
– |
perror("fork"); |
138 |
– |
exit(EXIT_FAILURE); |
139 |
– |
} |
140 |
– |
else if (pid > 0) |
141 |
– |
{ |
142 |
– |
print_startup(pid); |
143 |
– |
exit(EXIT_SUCCESS); |
144 |
– |
} |
145 |
– |
|
146 |
– |
setsid(); |
147 |
– |
} |
148 |
– |
|
149 |
– |
static int printVersion; |
150 |
– |
|
151 |
– |
static struct lgetopt myopts[] = |
152 |
– |
{ |
153 |
– |
{ "configfile", &ConfigGeneral.configfile, |
154 |
– |
STRING, "File to use for ircd.conf" }, |
155 |
– |
{ "klinefile", &ConfigGeneral.klinefile, |
156 |
– |
STRING, "File to use for kline database" }, |
157 |
– |
{ "dlinefile", &ConfigGeneral.dlinefile, |
158 |
– |
STRING, "File to use for dline database" }, |
159 |
– |
{ "xlinefile", &ConfigGeneral.xlinefile, |
160 |
– |
STRING, "File to use for xline database" }, |
161 |
– |
{ "resvfile", &ConfigGeneral.resvfile, |
162 |
– |
STRING, "File to use for resv database" }, |
163 |
– |
{ "logfile", &logFileName, |
164 |
– |
STRING, "File to use for ircd.log" }, |
165 |
– |
{ "pidfile", &pidFileName, |
166 |
– |
STRING, "File to use for process ID" }, |
167 |
– |
{ "foreground", &server_state.foreground, |
168 |
– |
YESNO, "Run in foreground (don't detach)" }, |
169 |
– |
{ "version", &printVersion, |
170 |
– |
YESNO, "Print version and exit" }, |
171 |
– |
{ "help", NULL, USAGE, "Print this text" }, |
172 |
– |
{ NULL, NULL, STRING, NULL }, |
173 |
– |
}; |
174 |
– |
|
144 |
|
void |
145 |
|
set_time(void) |
146 |
|
{ |
189 |
|
exit_aborted_clients(); |
190 |
|
free_exited_clients(); |
191 |
|
|
192 |
< |
/* Check to see whether we have to rehash the configuration .. */ |
192 |
> |
/* Check to see whether we have to rehash the configuration. */ |
193 |
|
if (dorehash) |
194 |
|
{ |
195 |
|
conf_rehash(1); |
400 |
|
#endif /* HAVE_LIBCRYPTO */ |
401 |
|
} |
402 |
|
|
403 |
+ |
/* |
404 |
+ |
* print_startup - print startup information |
405 |
+ |
*/ |
406 |
+ |
static void |
407 |
+ |
print_startup(int pid) |
408 |
+ |
{ |
409 |
+ |
printf("ircd: version %s(%s)\n", ircd_version, serno); |
410 |
+ |
printf("ircd: pid %d\n", pid); |
411 |
+ |
printf("ircd: running in %s mode from %s\n", !server_state.foreground ? "background" |
412 |
+ |
: "foreground", ConfigGeneral.dpath); |
413 |
+ |
} |
414 |
+ |
|
415 |
+ |
static void |
416 |
+ |
make_daemon(void) |
417 |
+ |
{ |
418 |
+ |
int pid; |
419 |
+ |
|
420 |
+ |
if ((pid = fork()) < 0) |
421 |
+ |
{ |
422 |
+ |
perror("fork"); |
423 |
+ |
exit(EXIT_FAILURE); |
424 |
+ |
} |
425 |
+ |
else if (pid > 0) |
426 |
+ |
{ |
427 |
+ |
print_startup(pid); |
428 |
+ |
exit(EXIT_SUCCESS); |
429 |
+ |
} |
430 |
+ |
|
431 |
+ |
setsid(); |
432 |
+ |
} |
433 |
+ |
|
434 |
|
int |
435 |
|
main(int argc, char *argv[]) |
436 |
|
{ |