ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/init.C
(Generate patch)

Comparing deliantra/server/server/init.C (file contents):
Revision 1.15 by root, Mon Oct 2 15:28:36 2006 UTC vs.
Revision 1.16 by pippijn, Mon Dec 11 19:46:47 2006 UTC

211 211
212void 212void
213set_csport (char *val) 213set_csport (char *val)
214{ 214{
215 settings.csport = atoi (val); 215 settings.csport = atoi (val);
216#ifndef WIN32 /* ***win32: set_csport: we remove csport error secure check here, do this later */
217 if (settings.csport <= 0 || settings.csport > 32765 || (settings.csport < 1024 && getuid () != 0)) 216 if (settings.csport <= 0 || settings.csport > 32765 || (settings.csport < 1024 && getuid () != 0))
218 { 217 {
219 LOG (llevError, "%d is an invalid csport number.\n", settings.csport); 218 LOG (llevError, "%d is an invalid csport number.\n", settings.csport);
220 exit (1); 219 exit (1);
221 } 220 }
222#endif /* win32 */
223} 221}
224 222
225/* Most of this is shamelessly stolen from XSysStats. But since that is 223/* Most of this is shamelessly stolen from XSysStats. But since that is
226 * also my program, no problem. 224 * also my program, no problem.
227 */ 225 */
265 {"-treasures", 1, 1, (void (*)()) set_treasures}, 263 {"-treasures", 1, 1, (void (*)()) set_treasures},
266 {"-uniquedir", 1, 1, (void (*)()) set_uniquedir}, 264 {"-uniquedir", 1, 1, (void (*)()) set_uniquedir},
267 {"-templatedir", 1, 1, (void (*)()) set_templatedir}, 265 {"-templatedir", 1, 1, (void (*)()) set_templatedir},
268 {"-tmpdir", 1, 1, (void (*)()) set_tmpdir}, 266 {"-tmpdir", 1, 1, (void (*)()) set_tmpdir},
269 {"-log", 1, 1, (void (*)()) set_logfile}, 267 {"-log", 1, 1, (void (*)()) set_logfile},
270
271#ifdef WIN32
272
273/* Windows service stuff */
274 {"-regsrv", 0, 1, service_register},
275 {"-unregsrv", 0, 1, service_unregister},
276 {"-srv", 0, 1, service_handle},
277#endif
278 268
279/* Pass 2 functions. Most of these could probably be in pass 1, 269/* Pass 2 functions. Most of these could probably be in pass 1,
280 * as they don't require much of anything to bet set up. 270 * as they don't require much of anything to bet set up.
281 */ 271 */
282 {"-csport", 1, 2, (void (*)()) set_csport}, 272 {"-csport", 1, 2, (void (*)()) set_csport},
1073 read_map_log (); /* Load up the old temp map files */ 1063 read_map_log (); /* Load up the old temp map files */
1074 init_skills (); 1064 init_skills ();
1075 1065
1076 parse_args (argc, argv, 3); 1066 parse_args (argc, argv, 3);
1077 1067
1078#ifndef WIN32 /* ***win32: no BecomeDaemon in windows */
1079 if (settings.daemonmode) 1068 if (settings.daemonmode)
1080 logfile = BecomeDaemon (settings.logfilename[0] == '\0' ? "logfile" : settings.logfilename); 1069 logfile = BecomeDaemon (settings.logfilename[0] == '\0' ? "logfile" : settings.logfilename);
1081#endif
1082 1070
1083 init_beforeplay (); 1071 init_beforeplay ();
1084 init_ericserver (); 1072 init_ericserver ();
1085 init_done = 1; 1073 init_done = 1;
1086} 1074}
1264 printf ("Editor:\t\t%s\n", X_EDITOR); 1252 printf ("Editor:\t\t%s\n", X_EDITOR);
1265#endif 1253#endif
1266 1254
1267 printf ("Max_time:\t%d\n", MAX_TIME); 1255 printf ("Max_time:\t%d\n", MAX_TIME);
1268 1256
1269#ifdef WIN32 /* ***win32 compile_info(): remove execl... */
1270 printf ("Logfilename:\t%s\n", settings.logfilename);
1271 exit (0);
1272#else
1273 execl ("/bin/uname", "uname", "-a", NULL); 1257 execl ("/bin/uname", "uname", "-a", NULL);
1274 LOG (llevError, "Oops, shouldn't have gotten here: execl(/bin/uname) failed: %s\n", strerror (errno)); 1258 LOG (llevError, "Oops, shouldn't have gotten here: execl(/bin/uname) failed: %s\n", strerror (errno));
1275 exit (-1); 1259 exit (-1);
1276#endif
1277} 1260}
1278 1261
1279/* Signal handlers: */ 1262/* Signal handlers: */
1280 1263
1281void 1264void
1341} 1324}
1342 1325
1343void 1326void
1344init_signals (void) 1327init_signals (void)
1345{ 1328{
1346#ifndef WIN32 /* init_signals() remove signals */
1347 signal (SIGHUP, rec_sighup); 1329 signal (SIGHUP, rec_sighup);
1348 signal (SIGINT, rec_sigint); 1330 signal (SIGINT, rec_sigint);
1349 signal (SIGQUIT, rec_sigquit); 1331 signal (SIGQUIT, rec_sigquit);
1350 signal (SIGSEGV, rec_sigsegv); 1332 signal (SIGSEGV, rec_sigsegv);
1351 signal (SIGPIPE, SIG_IGN); 1333 signal (SIGPIPE, SIG_IGN);
1352# ifdef SIGBUS 1334#ifdef SIGBUS
1353 signal (SIGBUS, rec_sigbus); 1335 signal (SIGBUS, rec_sigbus);
1354# endif 1336#endif
1355 signal (SIGTERM, rec_sigterm); 1337 signal (SIGTERM, rec_sigterm);
1356#endif
1357} 1338}
1358 1339
1359/* init_races() - reads the races file in the lib/ directory, then 1340/* init_races() - reads the races file in the lib/ directory, then
1360 * overwrites old 'race' entries. This routine allow us to quickly 1341 * overwrites old 'race' entries. This routine allow us to quickly
1361 * re-configure the 'alignment' of monsters, objects. Useful for 1342 * re-configure the 'alignment' of monsters, objects. Useful for

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines