1 | /* |
1 | /* |
2 | * static char *rcsid_init_c = |
2 | * static char *rcsid_init_c = |
3 | * "$Id: init.C,v 1.1 2006/08/13 17:16:04 elmex Exp $"; |
3 | * "$Id: init.C,v 1.3 2006/08/29 05:03:55 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
752 | #endif |
752 | #endif |
753 | |
753 | |
754 | init_beforeplay(); |
754 | init_beforeplay(); |
755 | init_ericserver(); |
755 | init_ericserver(); |
756 | metaserver_init(); |
756 | metaserver_init(); |
757 | reset_sleep(); |
|
|
758 | init_done=1; |
757 | init_done=1; |
759 | } |
758 | } |
760 | |
759 | |
761 | void usage(void) { |
760 | void usage(void) { |
762 | (void) fprintf(logfile, |
761 | (void) fprintf(logfile, |
… | |
… | |
961 | void rec_sigquit(int i) { |
960 | void rec_sigquit(int i) { |
962 | LOG(llevInfo,"\nSIGQUIT received\n"); |
961 | LOG(llevInfo,"\nSIGQUIT received\n"); |
963 | fatal_signal(1, 1); |
962 | fatal_signal(1, 1); |
964 | } |
963 | } |
965 | |
964 | |
966 | void rec_sigpipe(int i) { |
|
|
967 | |
|
|
968 | /* Keep running if we receive a sigpipe. Crossfire should really be able |
|
|
969 | * to handle this signal (at least at some point in the future if not |
|
|
970 | * right now). By causing a dump right when it is received, it is not |
|
|
971 | * doing much good. However, if it core dumps later on, at least it can |
|
|
972 | * be looked at later on, and maybe fix the problem that caused it to |
|
|
973 | * dump core. There is no reason that SIGPIPES should be fatal |
|
|
974 | */ |
|
|
975 | LOG(llevError,"\nSIGPIPE--------------\n------------\n--------\n---\n"); |
|
|
976 | #if 1 && !defined(WIN32) /* ***win32: we don't want send SIGPIPE */ |
|
|
977 | LOG(llevInfo,"\nReceived SIGPIPE, ignoring...\n"); |
|
|
978 | signal(SIGPIPE,rec_sigpipe);/* hocky-pux clears signal handlers */ |
|
|
979 | #else |
|
|
980 | LOG(llevError,"\nSIGPIPE received, not ignoring...\n"); |
|
|
981 | fatal_signal(1, 1); /*Might consider to uncomment this line */ |
|
|
982 | #endif |
|
|
983 | } |
|
|
984 | |
|
|
985 | void rec_sigbus(int i) { |
965 | void rec_sigbus(int i) { |
986 | #ifdef SIGBUS |
966 | #ifdef SIGBUS |
987 | LOG(llevError,"\nSIGBUS received\n"); |
967 | LOG(llevError,"\nSIGBUS received\n"); |
988 | fatal_signal(1, 1); |
968 | fatal_signal(1, 1); |
989 | #endif |
969 | #endif |
… | |
… | |
1006 | |
986 | |
1007 | void init_signals(void) { |
987 | void init_signals(void) { |
1008 | #ifndef WIN32 /* init_signals() remove signals */ |
988 | #ifndef WIN32 /* init_signals() remove signals */ |
1009 | signal(SIGHUP,rec_sighup); |
989 | signal(SIGHUP,rec_sighup); |
1010 | signal(SIGINT,rec_sigint); |
990 | signal(SIGINT,rec_sigint); |
1011 | #ifndef DEBUG |
|
|
1012 | signal(SIGQUIT,rec_sigquit); |
991 | signal(SIGQUIT,rec_sigquit); |
1013 | signal(SIGSEGV,rec_sigsegv); |
992 | signal(SIGSEGV,rec_sigsegv); |
1014 | LOG(llevInfo,"\n---------registering SIGPIPE\n"); |
993 | signal(SIGPIPE,SIG_IGN); |
1015 | signal(SIGPIPE,rec_sigpipe); |
|
|
1016 | #ifdef SIGBUS |
994 | #ifdef SIGBUS |
1017 | signal(SIGBUS,rec_sigbus); |
995 | signal(SIGBUS,rec_sigbus); |
1018 | #endif |
996 | #endif |
1019 | signal(SIGTERM,rec_sigterm); |
997 | signal(SIGTERM,rec_sigterm); |
1020 | #endif |
998 | #endif |
1021 | #endif /* win32 */ |
|
|
1022 | } |
999 | } |
1023 | |
1000 | |
1024 | /* init_races() - reads the races file in the lib/ directory, then |
1001 | /* init_races() - reads the races file in the lib/ directory, then |
1025 | * overwrites old 'race' entries. This routine allow us to quickly |
1002 | * overwrites old 'race' entries. This routine allow us to quickly |
1026 | * re-configure the 'alignment' of monsters, objects. Useful for |
1003 | * re-configure the 'alignment' of monsters, objects. Useful for |