-static void
-init_files(void)
-{
- int failed = 0;
- failed |= !ef_open(EF_NATION, EFF_MEM);
- failed |= !ef_open(EF_SECTOR, EFF_MEM);
- failed |= !ef_open(EF_SHIP, EFF_MEM);
- failed |= !ef_open(EF_PLANE, EFF_MEM);
- failed |= !ef_open(EF_LAND, EFF_MEM);
- failed |= !ef_open(EF_NEWS, 0);
- failed |= !ef_open(EF_LOAN, 0);
- failed |= !ef_open(EF_TREATY, 0);
- failed |= !ef_open(EF_NUKE, EFF_MEM);
- failed |= !ef_open(EF_POWER, 0);
- failed |= !ef_open(EF_TRADE, 0);
- failed |= !ef_open(EF_MAP, EFF_MEM);
- failed |= !ef_open(EF_BMAP, EFF_MEM);
- failed |= !ef_open(EF_COMM, 0);
- failed |= !ef_open(EF_LOST, 0);
- if (failed) {
- logerror("Missing files, giving up");
- exit(EXIT_FAILURE);
- }
-}
-
-static void
-close_files(void)
-{
- ef_close(EF_NATION);
- ef_close(EF_SECTOR);
- ef_close(EF_SHIP);
- ef_close(EF_PLANE);
- ef_close(EF_LAND);
- ef_close(EF_NEWS);
- ef_close(EF_LOAN);
- ef_close(EF_TREATY);
- ef_close(EF_NUKE);
- ef_close(EF_POWER);
- ef_close(EF_TRADE);
- ef_close(EF_MAP);
- ef_close(EF_COMM);
- ef_close(EF_BMAP);
- ef_close(EF_LOST);
-}
-
-/* we're going down. try to close the files at least */
-#if !defined(_WIN32)
-void
-panic(int sig)
-{
- struct sigaction act;
-
- act.sa_flags = 0;
- sigemptyset(&act.sa_mask);
- act.sa_handler = SIG_DFL;
- sigaction(SIGBUS, &act, NULL);
- sigaction(SIGSEGV, &act, NULL);
- sigaction(SIGILL, &act, NULL);
- sigaction(SIGFPE, &act, NULL);
- logerror("server received fatal signal %d", sig);
- log_last_commands();
- close_files();
- if (CANT_HAPPEN(sig != SIGBUS && sig != SIGSEGV
- && sig != SIGILL && sig != SIGFPE))
- _exit(1);
- if (raise(sig))
- _exit(1);
-}
-#endif /* _WIN32 */
-