#define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR,
LEVELDIR, SAVEDIR, BONESDIR, DATADIR,
- SCOREDIR, LOCKDIR, and CONFIGDIR. */
+ SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */
/* data librarian defs */
#ifndef NOCWD_ASSUMPTIONS
#define LEVELPREFIX 1
#define SAVEPREFIX 2
#define BONESPREFIX 3
-#define DATAPREFIX 4
+#define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */
#define SCOREPREFIX 5
#define LOCKPREFIX 6
#define CONFIGPREFIX 7
-#define PREFIX_COUNT 8
+#define TROUBLEPREFIX 8
+#define PREFIX_COUNT 9
/* used in files.c; xxconf.h can override if needed */
# ifndef FQN_MAX_FILENAME
#define FQN_MAX_FILENAME 512
/* ### files.c ### */
E const char *FDECL(fqname, (const char *, int, int));
-E FILE *FDECL(fopen_datafile, (const char *,const char *,BOOLEAN_P));
+E FILE *FDECL(fopen_datafile, (const char *,const char *,int));
E boolean FDECL(uptodate, (int,const char *));
E void FDECL(store_version, (int));
#ifdef MFLOPPY
it is defined for WIN32.
Allow paths to be specified for HACKDIR,
LEVELDIR, SAVEDIR, BONESDIR, DATADIR,
- SCOREDIR, LOCKDIR, and CONFIGDIR */
+ SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR */
#define NO_TERMS
#define ASCIIGRAPH
# endif
#define NOCWD_ASSUMPTIONS /* Allow paths to be specified for HACKDIR,
LEVELDIR, SAVEDIR, BONESDIR, DATADIR,
- SCOREDIR, LOCKDIR, and CONFIGDIR */
+ SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR. */
#endif /* MSDOS configuration stuff */
struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 }; /* AS,AE, LI,CO */
char *fqn_prefix[PREFIX_COUNT] = { (char *)0, (char *)0, (char *)0, (char *)0,
- (char *)0, (char *)0, (char *)0, (char *)0 };
+ (char *)0, (char *)0, (char *)0, (char *)0, (char *)0 };
#ifdef PREFIXES_IN_USE
char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir",
"bonesdir", "datadir", "scoredir",
- "lockdir", "configdir" };
+ "lockdir", "configdir", "troubledir" };
#endif
/* dummy routine used to force linkage */
#include <string.h>
#endif
+#define DATAPREFIX 4
+
#ifdef DLB
/*
* Data librarian. Present a STDIO-like interface to NetHack while
} dlb_procs_t;
/* without extern.h via hack.h, these haven't been declared for us */
-extern FILE *FDECL(fopen_datafile, (const char *,const char *,BOOLEAN_P));
+extern FILE *FDECL(fopen_datafile, (const char *,const char *,int));
#ifdef DLBLIB
/*
{
boolean status = FALSE;
- lp->fdata = fopen_datafile(lib_name, RDBMODE, FALSE);
+ lp->fdata = fopen_datafile(lib_name, RDBMODE, DATAPREFIX);
if (lp->fdata) {
if (readlibdir(lp)) {
status = TRUE;
dp = (dlb *) alloc(sizeof(dlb));
if (do_dlb_fopen(dp, name, mode))
dp->fp = (FILE *) 0;
- else if ((fp = fopen_datafile(name, mode, FALSE)) != 0)
+ else if ((fp = fopen_datafile(name, mode, DATAPREFIX)) != 0)
dp->fp = fp;
else {
/* can't find anything */
#endif
#ifdef PREFIXES_IN_USE
-#define FQN_NUMBUF 3
+#define FQN_NUMBUF 4
static char fqn_filename_buffer[FQN_NUMBUF][FQN_MAX_FILENAME];
#endif
/* fopen a file, with OS-dependent bells and whistles */
/* NOTE: a simpler version of this routine also exists in util/dlb_main.c */
FILE *
-fopen_datafile(filename, mode, use_scoreprefix)
+fopen_datafile(filename, mode, prefix)
const char *filename, *mode;
-boolean use_scoreprefix;
+int prefix;
{
FILE *fp;
- filename = fqname(filename,
- use_scoreprefix ? SCOREPREFIX : DATAPREFIX, 0);
+ filename = fqname(filename, prefix, prefix == TROUBLEPREFIX ? 3 : 0);
#ifdef VMS /* essential to have punctuation, to avoid logical names */
{
char tmp[BUFSIZ];
adjust_prefix(bufp, LOCKPREFIX);
} else if (match_varname(buf, "CONFIGDIR", 4)) {
adjust_prefix(bufp, CONFIGPREFIX);
+ } else if (match_varname(buf, "TROUBLEDIR", 4)) {
+ adjust_prefix(bufp, TROUBLEPREFIX);
#else /*NOCWD_ASSUMPTIONS*/
# ifdef MICRO
} else if (match_varname(buf, "HACKDIR", 4)) {
#ifdef PANICLOG
FILE *lfile;
- lfile = fopen_datafile(PANICLOG, "a", TRUE);
+ lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
if (lfile) {
(void) fprintf(lfile, "%08ld: %s %s\n",
yyyymmdd((time_t)0L), why, s);
#ifdef LOGFILE /* used for debugging (who dies of what, where) */
if (lock_file(LOGFILE, SCOREPREFIX, 10)) {
- if(!(lfile = fopen_datafile(LOGFILE, "a", TRUE))) {
+ if(!(lfile = fopen_datafile(LOGFILE, "a", SCOREPREFIX))) {
HUP raw_print("Cannot open log file!");
} else {
writeentry(lfile, t0);
goto destroywin;
#ifdef UPDATE_RECORD_IN_PLACE
- rfile = fopen_datafile(RECORD, "r+", TRUE);
+ rfile = fopen_datafile(RECORD, "r+", SCOREPREFIX);
#else
- rfile = fopen_datafile(RECORD, "r", TRUE);
+ rfile = fopen_datafile(RECORD, "r", SCOREPREFIX);
#endif
if (!rfile) {
t0->fpos : final_fpos), SEEK_SET);
#else
(void) fclose(rfile);
- if(!(rfile = fopen_datafile(RECORD, "w", TRUE))){
+ if(!(rfile = fopen_datafile(RECORD, "w", SCOREPREFIX))){
HUP raw_print("Cannot write record file");
unlock_file(RECORD);
free_ttlist(tt_head);
return;
}
- rfile = fopen_datafile(RECORD, "r", TRUE);
+ rfile = fopen_datafile(RECORD, "r", SCOREPREFIX);
if (!rfile) {
raw_print("Cannot open record file!");
return;
if (!otmp) return((struct obj *) 0);
- rfile = fopen_datafile(RECORD, "r", TRUE);
+ rfile = fopen_datafile(RECORD, "r", SCOREPREFIX);
if (!rfile) {
impossible("Cannot open record file!");
return (struct obj *)0;
#OPTIONS=suppress_alert:3.3.1
#
#
+# *** LOCATIONS ***
+# Some platforms allow you to change the location where various things are kept.
+# IMPORTANT: If you change any of these locations, the directories they
+# point at must exist. NetHack will not create them for you.
+#
+# The default location for everything.
+# Note: On Windows HACKDIR defaults to the location
+# of the NetHack.exe or NetHackw.exe file so
+# setting HACKDIR below to override that is
+# not usually necessary or recommended.
#HACKDIR=c:\games\nethack
-#
-# Note: Under MSDOS ports HACKDIR defaults to the location
-# of the NetHack.exe file. Setting HACKDIR above will override that.
#
-# LEVELS and SAVE default to HACKDIR
+# The location that level files in progress are stored (default=HACKDIR, writeable)
+#LEVELDIR=c:\nethack\levels
+#
+# The location where saved games are kept (default=HACKDIR, writeable)
+#SAVEDIR=c:\nethack\save
+#
+# The location that bones files are kept (default=HACKDIR, writeable)
+#BONESDIR=c:\nethack\save
+#
+# The location that file synchronization locks are stored (default=HACKDIR, writeable)
+#LOCKDIR=c:\nethack\levels
+#
+# The location that a record of game aborts and self-diagnosed game problems
+# is kept (default=HACKDIR, writeable)
+#TROUBLEDIR=c:\nethack\trouble
#
-#LEVELS=c:\games\nethack\bones
-#SAVE=c:\games\nethack\bones
-
# *** CHARACTER GRAPHICS ***
#
# See the on-line help or the Guidebook for which symbols are in which
# window, windowframe, windowtext.
#OPTIONS=windowcolors:status windowtext/window message windowtext/window
+# *** LOCATIONS ***
+# IMPORTANT: If you change any of these locations, the directories they
+# point at must exist. NetHack will not create them for you.
#
-#HACKDIR=c:\games\nethack
-#
+# HACKDIR is the default location for everything.
# Note: On Windows HACKDIR defaults to the location
-# of the NetHack.exe or NetHackw.exe file.
-# Setting HACKDIR above will override that.
+# of the NetHack.exe or NetHackw.exe file so
+# setting HACKDIR below to override that is
+# not usually necessary or recommended.
+#HACKDIR=c:\games\nethack
#
-# LEVELS and SAVE default to HACKDIR
+# The location that level files in progress are stored (default=HACKDIR, writeable)
+#LEVELDIR=c:\nethack\levels
+#
+# The location where saved games are kept (default=HACKDIR, writeable)
+#SAVEDIR=c:\nethack\save
+#
+# The location that bones files are kept (default=HACKDIR, writeable)
+#BONESDIR=c:\nethack\save
+#
+# The location that file synchronization locks are stored (default=HACKDIR, writeable)
+#LOCKDIR=c:\nethack\levels
+#
+# The location that a record of game aborts and self-diagnosed game problems
+# is kept (default=HACKDIR, writeable)
+#TROUBLEDIR=c:\nethack\trouble
#
-#LEVELS=c:\games\nethack\bones
-#SAVE=c:\games\nethack\bones
-
# *** CHARACTER GRAPHICS ***
#
# See the on-line help or the Guidebook for which symbols are in which