PANICTRACE option parsing
Fix the situation where disabling PANICTRACE, which happened implicitly when BETA got disabled, caused SYSCF option processing to complain and quit if the 'sysconf' file contained any PANICTRACE settings. Now accept all the PANICTRACE options (assuming SYSCF is defined) even if PANICTRACE is not defined. Their values are recorded in the 'sysopt' struct, but only validated when the appropriate macros (PANICTRACE, PANICTRACE_LIB) are defined.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 sys.h $NHDT-Date: 1448241778 2015/11/23 01:22:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
|
||||
/* NetHack 3.6 sys.h $NHDT-Date: 1449296291 2015/12/05 06:18:11 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.27 $ */
|
||||
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -20,23 +20,21 @@ struct sysopt {
|
||||
* -1: getenv() didn't find a value for DEBUGFILES.
|
||||
*/
|
||||
int maxplayers;
|
||||
int seduce;
|
||||
int check_save_uid; /* restoring savefile checks UID? */
|
||||
|
||||
/* record file */
|
||||
int persmax;
|
||||
int pers_is_uid;
|
||||
int entrymax;
|
||||
int pointsmin;
|
||||
int tt_oname_maxrank;
|
||||
#ifdef PANICTRACE
|
||||
|
||||
/* panic options */
|
||||
char *gdbpath;
|
||||
char *greppath;
|
||||
int panictrace_gdb;
|
||||
#ifdef PANICTRACE_LIBC
|
||||
int panictrace_libc;
|
||||
#endif
|
||||
#endif
|
||||
int seduce;
|
||||
int check_save_uid; /* restoring savefile checks UID? */
|
||||
};
|
||||
|
||||
extern struct sysopt sysopt;
|
||||
|
||||
24
src/files.c
24
src/files.c
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.6 files.c $NHDT-Date: 1449283964 2015/12/05 02:52:44 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.191 $ */
|
||||
/* NetHack 3.6 files.c $NHDT-Date: 1449296293 2015/12/05 06:18:13 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.192 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
@@ -2224,6 +2224,7 @@ int src;
|
||||
(void) strncpy(dogname, bufp, PL_PSIZ - 1);
|
||||
} else if (match_varname(buf, "CATNAME", 3)) {
|
||||
(void) strncpy(catname, bufp, PL_PSIZ - 1);
|
||||
|
||||
#ifdef SYSCF
|
||||
} else if (src == SET_IN_SYS && match_varname(buf, "WIZARDS", 7)) {
|
||||
if (sysopt.wizards)
|
||||
@@ -2249,7 +2250,7 @@ int src;
|
||||
/* if showdebug() has already been called (perhaps we've added
|
||||
some debugpline() calls to option processing) and has found
|
||||
a value for getenv("DEBUGFILES"), don't override that */
|
||||
if (sysopt.env_dbgfl == 0) {
|
||||
if (sysopt.env_dbgfl <= 0) {
|
||||
if (sysopt.debugfiles)
|
||||
free((genericptr_t) sysopt.debugfiles);
|
||||
sysopt.debugfiles = dupstr(bufp);
|
||||
@@ -2320,47 +2321,50 @@ int src;
|
||||
return 0;
|
||||
}
|
||||
sysopt.tt_oname_maxrank = n;
|
||||
#ifdef PANICTRACE
|
||||
|
||||
/* SYSCF PANICTRACE options */
|
||||
} else if (src == SET_IN_SYS
|
||||
&& match_varname(buf, "PANICTRACE_LIBC", 15)) {
|
||||
#ifdef PANICTRACE_LIBC
|
||||
n = atoi(bufp);
|
||||
#if defined(PANICTRACE) && defined(PANICTRACE_LIBC)
|
||||
if (n < 0 || n > 2) {
|
||||
raw_printf("Illegal value in PANICTRACE_LIBC (not 0,1,2).");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
sysopt.panictrace_libc = n;
|
||||
#endif /* PANICTRACE_LIBC */
|
||||
} else if (src == SET_IN_SYS
|
||||
&& match_varname(buf, "PANICTRACE_GDB", 14)) {
|
||||
n = atoi(bufp);
|
||||
#if defined(PANICTRACE)
|
||||
if (n < 0 || n > 2) {
|
||||
raw_printf("Illegal value in PANICTRACE_GDB (not 0,1,2).");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
sysopt.panictrace_gdb = n;
|
||||
} else if (src == SET_IN_SYS && match_varname(buf, "GDBPATH", 7)) {
|
||||
#ifndef VMS /* VMS panictrace support doesn't use gdb or grep */
|
||||
#if defined(PANICTRACE) && !defined(VMS)
|
||||
if (!file_exists(bufp)) {
|
||||
raw_printf("File specified in GDBPATH does not exist.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (sysopt.gdbpath)
|
||||
free((genericptr_t) sysopt.gdbpath);
|
||||
sysopt.gdbpath = dupstr(bufp);
|
||||
#endif
|
||||
} else if (src == SET_IN_SYS && match_varname(buf, "GREPPATH", 7)) {
|
||||
#ifndef VMS /* VMS panictrace support doesn't use gdb or grep */
|
||||
#if defined(PANICTRACE) && !defined(VMS)
|
||||
if (!file_exists(bufp)) {
|
||||
raw_printf("File specified in GREPPATH does not exist.");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (sysopt.greppath)
|
||||
free((genericptr_t) sysopt.greppath);
|
||||
sysopt.greppath = dupstr(bufp);
|
||||
#endif /* !VMS */
|
||||
#endif /* PANICTRACE */
|
||||
#endif /* SYSCF */
|
||||
|
||||
} else if (match_varname(buf, "BOULDER", 3)) {
|
||||
(void) get_uchars(fp, buf, bufp, &iflags.bouldersym, TRUE, 1,
|
||||
"BOULDER");
|
||||
|
||||
Reference in New Issue
Block a user