travel option
mouse_support wincap option
debug mode: #panic routine to test panic() and panic save file generation
+a new PANICLOG optional file to log the reason for panic and impossible messages
/*
* Section 2: Some global parameters and filenames.
- * Commenting out WIZARD, LOGFILE, or NEWS removes that feature
- * from the game; otherwise set the appropriate wizard name.
- * LOGFILE and NEWS refer to files in the playground.
+ * Commenting out WIZARD, LOGFILE, NEWS or PANICLOG removes that
+ * feature from the game; otherwise set the appropriate wizard
+ * name. LOGFILE, NEWS and PANICLOG refer to files in the
+ * playground.
*/
#ifndef WIZARD /* allow for compile-time or Makefile changes */
#define LOGFILE "logfile" /* larger file for debugging purposes */
#define NEWS "news" /* the file containing the latest hack news */
+#define PANICLOG "paniclog" /* log of panic and impossible events */
/*
* If COMPRESS is defined, it should contain the full path name of your
#if defined(WIZARD)
E void NDECL(read_wizkit);
#endif
+E void FDECL(paniclog, (const char *, const char *));
/* ### fountain.c ### */
char buf[BUFSZ];
Vsprintf(buf,str,VA_ARGS);
raw_print(buf);
+ paniclog("panic", buf);
}
#if defined(WIZARD) && (defined(UNIX) || defined(VMS) || defined(LATTICE) || defined(WIN32))
if (wizard)
/* ---------- END SCOREBOARD CREATION ----------- */
+/* ---------- BEGIN PANIC/IMPOSSIBLE LOG ----------- */
+
+/*ARGSUSED*/
+void
+paniclog(why, s)
+const char* why;
+const char* s;
+{
+#ifdef PANICLOG
+ FILE *lfile;
+
+ lfile = fopen_datafile(PANICLOG, "a", TRUE);
+ if (lfile) {
+ (void) fprintf(lfile, "%08ld: %s %s\n",
+ yyyymmdd((time_t)0L), why, s);
+ (void) fclose(lfile);
+ }
+#endif /* PANICLOG */
+}
+
+/* ---------- END PANIC/IMPOSSIBLE LOG ----------- */
+
/*files.c*/
impossible VA_DECL(const char *, s)
VA_START(s);
VA_INIT(s, const char *);
+ {
+ char pbuf[BUFSZ];
+ Vsprintf(pbuf,s,VA_ARGS);
+ paniclog("impossible", s);
+ }
vpline(s,VA_ARGS);
pline("Program in disorder - perhaps you'd better #quit.");
VA_END();