… | |
… | |
268 | {"-detach", 0, 2, set_daemon}, |
268 | {"-detach", 0, 2, set_daemon}, |
269 | |
269 | |
270 | /* Start of pass 3 information. In theory, by pass 3, all data paths |
270 | /* Start of pass 3 information. In theory, by pass 3, all data paths |
271 | * and defaults should have been set up. |
271 | * and defaults should have been set up. |
272 | */ |
272 | */ |
273 | {"-o", 0, 3, compile_info}, |
|
|
274 | {"-m", 0, 3, set_dumpmon1}, |
273 | {"-m", 0, 3, set_dumpmon1}, |
275 | {"-m2", 0, 3, set_dumpmon2}, |
274 | {"-m2", 0, 3, set_dumpmon2}, |
276 | {"-m3", 0, 3, set_dumpmon3}, |
275 | {"-m3", 0, 3, set_dumpmon3}, |
277 | {"-m4", 0, 3, set_dumpmon4}, |
276 | {"-m4", 0, 3, set_dumpmon4}, |
278 | {"-m5", 0, 3, set_dumpmon5}, |
277 | {"-m5", 0, 3, set_dumpmon5}, |
… | |
… | |
943 | { |
942 | { |
944 | fprintf (logfile, "Maintained locally by: %s\n", settings.dm_mail); |
943 | fprintf (logfile, "Maintained locally by: %s\n", settings.dm_mail); |
945 | fprintf (logfile, "Questions and bugs should be mailed to above address.\n"); |
944 | fprintf (logfile, "Questions and bugs should be mailed to above address.\n"); |
946 | } |
945 | } |
947 | |
946 | |
948 | init_startup (); /* Write (C), check shutdown/forbid files */ |
|
|
949 | init_uuid (); |
947 | init_uuid (); |
950 | init_signals (); /* Sets up signal interceptions */ |
948 | init_signals (); /* Sets up signal interceptions */ |
951 | init_commands (); /* Sort command tables */ |
949 | init_commands (); /* Sort command tables */ |
952 | init_skills (); |
950 | init_skills (); |
953 | |
951 | |
… | |
… | |
1018 | init_gods (); /* init linked list of gods from archs */ |
1016 | init_gods (); /* init linked list of gods from archs */ |
1019 | init_readable (); /* inits useful arrays for readable texts */ |
1017 | init_readable (); /* inits useful arrays for readable texts */ |
1020 | init_formulae (); /* If not called before, reads formulae from file */ |
1018 | init_formulae (); /* If not called before, reads formulae from file */ |
1021 | } |
1019 | } |
1022 | |
1020 | |
1023 | void |
|
|
1024 | init_startup (void) |
|
|
1025 | { |
|
|
1026 | char buf[MAX_BUF]; |
|
|
1027 | FILE *fp; |
|
|
1028 | int comp; |
|
|
1029 | |
|
|
1030 | #ifdef SHUTDOWN_FILE |
|
|
1031 | sprintf (buf, "%s/%s", settings.confdir, SHUTDOWN_FILE); |
|
|
1032 | if ((fp = open_and_uncompress (buf, 0, &comp)) != NULL) |
|
|
1033 | { |
|
|
1034 | while (fgets (buf, MAX_BUF - 1, fp) != NULL) |
|
|
1035 | printf ("%s", buf); |
|
|
1036 | close_and_delete (fp, comp); |
|
|
1037 | exit (1); |
|
|
1038 | } |
|
|
1039 | #endif |
|
|
1040 | |
|
|
1041 | if (forbid_play ()) |
|
|
1042 | { /* Maybe showing highscore should be allowed? */ |
|
|
1043 | LOG (llevError, "CrossFire: Playing not allowed.\n"); |
|
|
1044 | exit (-1); |
|
|
1045 | } |
|
|
1046 | } |
|
|
1047 | |
|
|
1048 | /* |
|
|
1049 | * compile_info(): activated with the -o flag. |
|
|
1050 | * It writes out information on how Imakefile and config.h was configured |
|
|
1051 | * at compile time. |
|
|
1052 | */ |
|
|
1053 | |
|
|
1054 | void |
|
|
1055 | compile_info (void) |
|
|
1056 | { |
|
|
1057 | int i = 0; |
|
|
1058 | |
|
|
1059 | printf ("Non-standard include files:\n"); |
|
|
1060 | #if !defined (__STRICT_ANSI__) || defined (__sun__) |
|
|
1061 | # if !defined (Mips) |
|
|
1062 | printf ("<stdlib.h>\n"); |
|
|
1063 | i = 1; |
|
|
1064 | # endif |
|
|
1065 | # if !defined (MACH) && !defined (sony) |
|
|
1066 | printf ("<malloc.h>\n"); |
|
|
1067 | i = 1; |
|
|
1068 | # endif |
|
|
1069 | #endif |
|
|
1070 | #ifndef __STRICT_ANSI__ |
|
|
1071 | # ifndef MACH |
|
|
1072 | printf ("<memory.h\n"); |
|
|
1073 | i = 1; |
|
|
1074 | # endif |
|
|
1075 | #endif |
|
|
1076 | #ifndef sgi |
|
|
1077 | printf ("<sys/timeb.h>\n"); |
|
|
1078 | i = 1; |
|
|
1079 | #endif |
|
|
1080 | if (!i) |
|
|
1081 | printf ("(none)\n"); |
|
|
1082 | printf ("Datadir:\t\t%s\n", settings.datadir); |
|
|
1083 | printf ("Localdir:\t\t%s\n", settings.localdir); |
|
|
1084 | #ifdef PERM_FILE |
|
|
1085 | printf ("Perm file:\t<ETC>/%s\n", PERM_FILE); |
|
|
1086 | #endif |
|
|
1087 | #ifdef SHUTDOWN_FILE |
|
|
1088 | printf ("Shutdown file:\t<ETC>/%s\n", SHUTDOWN_FILE); |
|
|
1089 | #endif |
|
|
1090 | printf ("Save player:\t<true>\n"); |
|
|
1091 | printf ("Save mode:\t%4.4o\n", SAVE_MODE); |
|
|
1092 | printf ("Playerdir:\t<VAR>/%s\n", settings.playerdir); |
|
|
1093 | printf ("Itemsdir:\t<VAR>/%s\n", settings.uniquedir); |
|
|
1094 | printf ("Tmpdir:\t\t%s\n", settings.tmpdir); |
|
|
1095 | #ifdef USE_CALLOC |
|
|
1096 | printf ("Use_calloc:\t<true>\n"); |
|
|
1097 | #else |
|
|
1098 | printf ("Use_calloc:\t<false>\n"); |
|
|
1099 | #endif |
|
|
1100 | |
|
|
1101 | #ifdef X_EDITOR |
|
|
1102 | printf ("Editor:\t\t%s\n", X_EDITOR); |
|
|
1103 | #endif |
|
|
1104 | |
|
|
1105 | printf ("Max_time:\t%d\n", MAX_TIME); |
|
|
1106 | |
|
|
1107 | execl ("/bin/uname", "uname", "-a", NULL); |
|
|
1108 | LOG (llevError, "Oops, shouldn't have gotten here: execl(/bin/uname) failed: %s\n", strerror (errno)); |
|
|
1109 | exit (-1); |
|
|
1110 | } |
|
|
1111 | |
|
|
1112 | /* Signal handlers: */ |
1021 | /* Signal handlers: */ |
1113 | |
1022 | |
1114 | static void |
1023 | static void |
1115 | rec_sigabrt (int i) |
1024 | rec_sigabrt (int i) |
1116 | { |
1025 | { |