#include "hack.h"#include "dlb.h"#include <ctype.h>#include <fcntl.h>#include <errno.h>
Defines | |
| #define | O_BINARY 0 |
| #define | SAVESIZE FILENAME |
| #define | HUP if (!program_state.done_hup) |
| #define | fopenp fopen |
| #define | match_varname(INP, NAM, LEN) match_optname(INP, NAM, LEN, TRUE) |
| #define | tmp_levels (char *)0 |
| #define | tmp_ramdisk (char *)0 |
Functions | |
| STATIC_DCL char * | FDECL (set_bonesfile_name,(char *, d_level *)) |
| STATIC_DCL char * | NDECL (set_bonestemp_name) |
| STATIC_DCL char * | FDECL (make_lockname,(const char *, char *)) |
| STATIC_DCL FILE * | FDECL (fopen_config_file,(const char *)) |
| STATIC_DCL int | FDECL (get_uchars,(FILE *, char *, char *, uchar *, BOOLEAN_P, int, const char *)) |
| int | FDECL (parse_config_line,(FILE *, char *, char *, char *)) |
| char * | fname_encode (char *legal, char quotechar, char *s, char *callerbuf, int bufsz) const |
| char * | fname_decode (char quotechar, char *s, char *callerbuf, int bufsz) |
| const char * | fqname (char *basename, int whichprefix, int buffnum) const |
| int | validate_prefix_locations (char *reasonbuf) |
| FILE * | fopen_datafile (char *filename, char *mode, int prefix) const |
| void | set_levelfile_name (char *file, int lev) |
| int | create_levelfile (int lev, errbuf) |
| int | open_levelfile (int lev, errbuf) |
| void | delete_levelfile (int lev) |
| void | clearlocks () |
| STATIC_OVL char * | set_bonesfile_name (char *file, d_level *lev) |
| STATIC_OVL char * | set_bonestemp_name () |
| int | create_bonesfile (d_level *lev, char **bonesid, errbuf) |
| void | commit_bonesfile (d_level *lev) |
| int | open_bonesfile (d_level *lev, char **bonesid) |
| int | delete_bonesfile (d_level *lev) |
| void | compress_bonesfile () |
| void | set_savefile_name () |
| int | create_savefile () |
| int | open_savefile () |
| int | delete_savefile () |
| int | restore_saved_game () |
| char ** | get_saved_games () |
| void | free_saved_games (char **saved) |
| void | compress (char *filename) const |
| void | uncompress (char *filename) const |
| STATIC_OVL char * | make_lockname (char *filename, char *lockname) const |
| boolean | lock_file (char *filename, int whichprefix, int retryct) const |
| void | unlock_file (char *filename) const |
| STATIC_OVL FILE * | fopen_config_file (char *filename) const |
| STATIC_OVL int | get_uchars (FILE *fp, char *buf, char *bufp, uchar *list, boolean modlist, int size, const char *name) |
| int | parse_config_line (FILE *fp, char *buf, char *tmp_ramdisk, char *tmp_levels) |
| void | read_config_file (char *filename) const |
| void | check_recordfile (char *dir) const |
| void | paniclog (char *type, const char *reason) const |
Variables | |
| int | errno |
| char | bones [] = "bonesnn.xxx" |
| char | lock [PL_NSIZ+14] = "1lock" |
| char | SAVEF [SAVESIZE] |
| int | n_dgns |
| static int | nesting = 0 |
| const char * | configfile = "UnNetHack.cnf" |
| const char * | oldconfigfile = "NetHack.cnf" |
| #define fopenp fopen |
Referenced by fopen_config_file().
| #define HUP if (!program_state.done_hup) |
Referenced by lock_file(), topten(), and unlock_file().
| #define match_varname | ( | INP, | |
| NAM, | |||
| LEN | |||
| ) | match_optname(INP, NAM, LEN, TRUE) |
Referenced by parse_config_line().
| #define O_BINARY 0 |
Referenced by create_bonesfile(), create_levelfile(), create_savefile(), getlev(), open_bonesfile(), open_levelfile(), and open_savefile().
| #define SAVESIZE FILENAME |
Referenced by parse_config_line().
| #define tmp_levels (char *)0 |
Referenced by read_config_file().
| #define tmp_ramdisk (char *)0 |
Referenced by read_config_file().
| void check_recordfile | ( | char * | dir ) | const |
| void clearlocks | ( | ) |
References alllevels, delete_levelfile(), levels, maxledgerno(), permbones, and ramdisk.
Referenced by done(), and restlevelfile().


| void commit_bonesfile | ( | d_level * | lev ) |
References bones, BONESPREFIX, fqname(), pline(), rename(), set_bonesfile_name(), set_bonestemp_name(), unlink(), and wizard.
Referenced by savebones().


| void compress | ( | char * | filename ) | const |
References FALSE.
Referenced by compress_bonesfile(), and dosave0().

| void compress_bonesfile | ( | ) |
References bones, BONESPREFIX, compress(), and fqname().
Referenced by getbones(), and savebones().


| int create_bonesfile | ( | d_level * | lev, |
| char ** | bonesid, | ||
| errbuf | |||
| ) |
References bones, BONESPREFIX, creat(), errno, FCMASK, fqname(), lock, O_BINARY, open(), set_bonesfile_name(), set_bonestemp_name(), and Sprintf.
Referenced by savebones().


| int create_levelfile | ( | int | lev, |
| errbuf | |||
| ) |
References creat(), errno, FCMASK, linfo::flags, fqname(), level_info, LEVELPREFIX, LFILE_EXISTS, lock, O_BINARY, open(), set_levelfile_name(), and Sprintf.
Referenced by currentlevel_rewrite(), and restlevelfile().


| int create_savefile | ( | ) |
| int delete_bonesfile | ( | d_level * | lev ) |
References bones, BONESPREFIX, fqname(), set_bonesfile_name(), and unlink().
Referenced by getbones(), and savebones().


| void delete_levelfile | ( | int | lev ) |
References linfo::flags, flags, fqname(), level_info, LEVELPREFIX, LFILE_EXISTS, lock, set_levelfile_name(), and unlink().
Referenced by clearlocks(), currentlevel_rewrite(), dosave0(), and goto_level().


| int delete_savefile | ( | ) |
References fqname(), SAVEF, SAVEPREFIX, and unlink().
Referenced by dorecover(), dosave0(), mread(), and restore_saved_game().


| STATIC_DCL FILE* FDECL | ( | fopen_config_file | , |
| (const char *) | |||
| ) |
| STATIC_DCL int FDECL | ( | get_uchars | , |
| (FILE *, char *, char *, uchar *, BOOLEAN_P, int, const char *) | |||
| ) |
| STATIC_DCL char* FDECL | ( | make_lockname | , |
| (const char *, char *) | |||
| ) |
| int FDECL | ( | parse_config_line | , |
| (FILE *, char *, char *, char *) | |||
| ) |
| STATIC_DCL char* FDECL | ( | set_bonesfile_name | , |
| (char *, d_level *) | |||
| ) |
| char* fname_decode | ( | char | quotechar, |
| char * | s, | ||
| char * | callerbuf, | ||
| int | bufsz | ||
| ) |
| char* fname_encode | ( | char * | legal, |
| char | quotechar, | ||
| char * | s, | ||
| char * | callerbuf, | ||
| int | bufsz | ||
| ) | const |
| STATIC_OVL FILE* fopen_config_file | ( | char * | filename ) | const |
References access(), BUFSZ, CONFIGPREFIX, errno, fopenp, fqname(), nh_getenv(), Sprintf, Strcpy, and wait_synch.
Referenced by read_config_file().


| FILE* fopen_datafile | ( | char * | filename, |
| char * | mode, | ||
| int | prefix | ||
| ) | const |
References BUFSIZ, fqname(), index, and TROUBLEPREFIX.
Referenced by paniclog(), prscore(), topten(), and tt_oname().


| const char* fqname | ( | char * | basename, |
| int | whichprefix, | ||
| int | buffnum | ||
| ) | const |
References FQN_MAX_FILENAME, fqn_prefix, PREFIX_COUNT, and Strcpy.
Referenced by check_recordfile(), commit_bonesfile(), compress_bonesfile(), create_bonesfile(), create_levelfile(), create_savefile(), delete_bonesfile(), delete_levelfile(), delete_savefile(), dosave0(), fopen_config_file(), fopen_datafile(), lock_file(), open_bonesfile(), open_levelfile(), open_savefile(), restore_saved_game(), unlock_file(), and validate_prefix_locations().

| void free_saved_games | ( | char** | saved ) |
| STATIC_OVL int get_uchars | ( | FILE * | fp, |
| char * | buf, | ||
| char * | bufp, | ||
| uchar * | list, | ||
| boolean | modlist, | ||
| int | size, | ||
| const char * | name | ||
| ) |
References BUFSZ, FALSE, TRUE, and wait_synch.
Referenced by parse_config_line().

| boolean lock_file | ( | char * | filename, |
| int | whichprefix, | ||
| int | retryct | ||
| ) | const |
References BUFSZ, DeleteFile, errno, FALSE, fqname(), HUP, LOCKPREFIX, make_lockname(), open(), perror, raw_print(), S_IWRITE, SEEK_SET, and TRUE.
Referenced by topten().


| STATIC_OVL char* make_lockname | ( | char * | filename, |
| char * | lockname | ||
| ) | const |
References rindex, Strcat, and Strcpy.
Referenced by lock_file(), and unlock_file().

| STATIC_DCL char* NDECL | ( | set_bonestemp_name | ) |
| int open_bonesfile | ( | d_level * | lev, |
| char ** | bonesid | ||
| ) |
References bones, BONESPREFIX, fqname(), O_BINARY, open(), set_bonesfile_name(), and uncompress().
Referenced by getbones(), and savebones().


| int open_levelfile | ( | int | lev, |
| errbuf | |||
| ) |
References errno, fqname(), level_info, LEVELPREFIX, lock, O_BINARY, open(), set_levelfile_name(), Sprintf, and where.
Referenced by dosave0(), and goto_level().


| int open_savefile | ( | ) |
References fqname(), O_BINARY, open(), SAVEF, and SAVEPREFIX.
Referenced by dosave0(), and restore_saved_game().


| void paniclog | ( | char * | type, |
| const char * | reason | ||
| ) | const |
References BUFSZ, fopen_datafile(), PANICLOG, plname, program_state, TROUBLEPREFIX, u, you::ubirthday, version_string(), and yyyymmdd().
Referenced by done(), savebones(), validate_prefix_locations(), and yn_function().


| int parse_config_line | ( | FILE * | fp, |
| char * | buf, | ||
| char * | tmp_ramdisk, | ||
| char * | tmp_levels | ||
| ) |
References AMII_MAXCOLORS, amii_setpens(), assign_graphics(), assign_warnings(), BONESPREFIX, instance_flags::bouldersym, catname, CONFIGPREFIX, DATAPREFIX, DEPTH, dogname, eos(), FALSE, flags, get_uchars(), hackdir, HACKPREFIX, iflags, index, flag::initrole, LEVELPREFIX, LOCKPREFIX, match_varname, MAXDCHARS, MAXECHARS, MAXMCLASSES, MAXOCLASSES, MAXPCHARS, MAXTCHARS, min, monsyms, oc_syms, parse_monster_color(), parseoptions(), PATHLEN, PL_NSIZ, PL_PSIZ, plname, plnamesuffix(), SAVEPREFIX, SAVESIZE, SCOREPREFIX, str2role(), strdup, TROUBLEPREFIX, TRUE, and WARNCOUNT.
Referenced by read_config_file().


| void read_config_file | ( | char * | filename ) | const |
References bones, BUFSZ, fopen_config_file(), levels, parse_config_line(), PATHLEN, permbones, ramdisk, set_duplicate_opt_detection(), Strcpy, tmp_levels, tmp_ramdisk, TRUE, and wait_synch.
Referenced by initoptions().


| int restore_saved_game | ( | ) |
References close(), delete_savefile(), fqname(), open_savefile(), SAVEF, SAVEPREFIX, set_savefile_name(), uncompress(), and uptodate().

| STATIC_OVL char* set_bonesfile_name | ( | char * | file, |
| d_level * | lev | ||
| ) |
References s_level::boneid, dungeon::boneid, d_level::dlevel, d_level::dnum, dungeons, eos(), Role::filecode, In_quest(), Is_special(), Sprintf, Strcat, and urole.
Referenced by commit_bonesfile(), create_bonesfile(), delete_bonesfile(), and open_bonesfile().


| STATIC_OVL char* set_bonestemp_name | ( | ) |
References eos(), lock, rindex, Sprintf, and Strcat.
Referenced by commit_bonesfile(), and create_bonesfile().


| void set_levelfile_name | ( | char * | file, |
| int | lev | ||
| ) |
References eos(), rindex, Sprintf, and Strcat.
Referenced by create_levelfile(), delete_levelfile(), and open_levelfile().


| void set_savefile_name | ( | ) |
References BUFSZ, FILENAME, fname_encode(), getuid, PATHLEN, plname, regularize(), SAVEF, Sprintf, Strcat, and Strcpy.
Referenced by restore_saved_game().


| void uncompress | ( | char * | filename ) | const |
References TRUE.
Referenced by dosave0(), open_bonesfile(), and restore_saved_game().

| void unlock_file | ( | char * | filename ) | const |
References BUFSZ, close(), DeleteFile, fqname(), HUP, LOCKPREFIX, make_lockname(), and unlink().
Referenced by topten().


| int validate_prefix_locations | ( | char * | reasonbuf ) |
References BUFSZ, CONFIGPREFIX, DATAPREFIX, errno, fqn_prefix, fqname(), paniclog(), PREFIX_COUNT, Sprintf, Strcat, and unlink().

| char bones[] = "bonesnn.xxx" |
Referenced by commit_bonesfile(), compress_bonesfile(), create_bonesfile(), delete_bonesfile(), getbones(), open_bonesfile(), read_config_file(), and savebones().
| const char* configfile = "UnNetHack.cnf" |
Referenced by badoption(), option_help(), and rejectoption().
| int errno |
Referenced by create_bonesfile(), create_levelfile(), fopen_config_file(), lock_file(), open_levelfile(), and validate_prefix_locations().
| char lock[PL_NSIZ+14] = "1lock" |
Referenced by create_bonesfile(), create_levelfile(), delete_levelfile(), open_levelfile(), and set_bonestemp_name().
| int n_dgns |
Referenced by arti_invoke(), deepest_lev_reached(), dname_to_dnum(), init_dungeons(), ledger_to_dnum(), and mk_knox_portal().
int nesting = 0 [static] |
| const char* oldconfigfile = "NetHack.cnf" |
| char SAVEF[SAVESIZE] |
Referenced by create_savefile(), delete_savefile(), dosave0(), open_savefile(), restore_saved_game(), and set_savefile_name().
1.7.2