version 1.75 | | version 1.76 |
---|
| | |
/* | | /* |
* static char *rcsid_init_c = | | * static char *rcsid_init_c = |
* "$Id: init.c,v 1.75 2006/03/14 17:12:28 ryo_saeba Exp $"; | | * "$Id: init.c,v 1.76 2006/03/18 15:05:37 ryo_saeba Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
#include <sproto.h> | | #include <sproto.h> |
#endif | | #endif |
| | |
/* global weathermap */ | | /** global weathermap */ |
weathermap_t **weathermap; | | weathermap_t **weathermap; |
| | |
void set_logfile(char *val) { settings.logfilename=val; } | | void set_logfile(char *val) { settings.logfilename=val; } |
| | |
#endif /* win32 */ | | #endif /* win32 */ |
} | | } |
| | |
/* Most of this is shamelessly stolen from XSysStats. But since that is | | /** Most of this is shamelessly stolen from XSysStats. But since that is |
* also my program, no problem. | | * also my program, no problem. |
*/ | | */ |
struct Command_Line_Options { | | struct Command_Line_Options { |
| | |
*/ | | */ |
}; | | }; |
| | |
/* The way this system works is pretty simple - parse_args takes | | /** The way this system works is pretty simple - parse_args takes |
* the options passed to the program and a pass number. If an option | | * the options passed to the program and a pass number. If an option |
* matches both in name and in pass (and we have enough options), | | * matches both in name and in pass (and we have enough options), |
* we call the associated function. This makes writing a multi | | * we call the associated function. This makes writing a multi |
| | |
*/ | | */ |
struct Command_Line_Options options[] = { | | struct Command_Line_Options options[] = { |
| | |
/* Pass 1 functions - STuff that can/should be called before we actually | | /** Pass 1 functions - STuff that can/should be called before we actually |
* initialize any data. | | * initialize any data. |
*/ | | */ |
{"-h", 0, 1, help}, | | {"-h", 0, 1, help}, |
| | |
{"-srv", 0, 1, service_handle}, | | {"-srv", 0, 1, service_handle}, |
#endif | | #endif |
| | |
/* Pass 2 functions. Most of these could probably be in pass 1, | | /** Pass 2 functions. Most of these could probably be in pass 1, |
* as they don't require much of anything to bet set up. | | * as they don't require much of anything to bet set up. |
*/ | | */ |
{"-csport", 1, 2, set_csport}, | | {"-csport", 1, 2, set_csport}, |
{"-detach", 0, 2, set_daemon}, | | {"-detach", 0, 2, set_daemon}, |
| | |
/* Start of pass 3 information. In theory, by pass 3, all data paths | | /** Start of pass 3 information. In theory, by pass 3, all data paths |
* and defaults should have been set up. | | * and defaults should have been set up. |
*/ | | */ |
{"-o", 0, 3, compile_info}, | | {"-o", 0, 3, compile_info}, |
| | |
}; | | }; |
| | |
| | |
/* Note since this may be called before the library has been set up, | | /** Note since this may be called before the library has been set up, |
* we don't use any of crossfires built in logging functions. | | * we don't use any of crossfires built in logging functions. |
*/ | | */ |
static void parse_args(int argc, char *argv[], int pass) | | static void parse_args(int argc, char *argv[], int pass) |
| | |
fclose(fp); | | fclose(fp); |
} | | } |
| | |
/* This loads the settings file. There could be debate whether this should | | /** |
| | * This loads the settings file. There could be debate whether this should |
* be here or in the common directory - but since only the server needs this | | * be here or in the common directory - but since only the server needs this |
* information, having it here probably makes more sense. | | * information, having it here probably makes more sense. |
*/ | | */ |
| | |
} | | } |
| | |
| | |
/* | | /** |
* init() is called only once, when starting the program. | | * init() is called only once, when starting the program. |
*/ | | */ |
| | |
| | |
| | |
parse_args(argc, argv, 3); | | parse_args(argc, argv, 3); |
| | |
#ifndef WIN32 /* ***win32: no BecomeDaemon in windows */ | | #ifndef WIN32 /* ***win32: no become_daemon in windows */ |
if (settings.daemonmode) | | if (settings.daemonmode) |
logfile = BecomeDaemon(settings.logfilename[0]=='\0'?"logfile":settings.logfilename); | | logfile = become_daemon(settings.logfilename[0]=='\0'?"logfile":settings.logfilename); |
#endif | | #endif |
| | |
init_beforeplay(); | | init_beforeplay(); |
| | |
} | | } |
} | | } |
| | |
/* | | /** |
* compile_info(): activated with the -o flag. | | * compile_info(): activated with the -o flag. |
* It writes out information on how Imakefile and config.h was configured | | * It writes out information on how Imakefile and config.h was configured |
* at compile time. | | * at compile time. |
| | |
#endif /* win32 */ | | #endif /* win32 */ |
} | | } |
| | |
/* init_races() - reads the races file in the lib/ directory, then | | /** |
| | * Reads the races file in the lib/ directory, then |
* overwrites old 'race' entries. This routine allow us to quickly | | * overwrites old 'race' entries. This routine allow us to quickly |
* re-configure the 'alignment' of monsters, objects. Useful for | | * re-configure the 'alignment' of monsters, objects. Useful for |
* putting together lists of creatures, etc that belong to gods. | | * putting together lists of creatures, etc that belong to gods. |