paniclog enhancement

Include the version number in paniclog entries, so there'll be more
information whenever someone forwards them to us.
This commit is contained in:
nethack.rankin
2003-11-23 10:01:58 +00:00
parent 17578658ce
commit d74990926c
4 changed files with 23 additions and 10 deletions
+1
View File
@@ -126,6 +126,7 @@ extend autodig to work downwards via '>'
make attribute that is used to distinguish headings in a menu configurable make attribute that is used to distinguish headings in a menu configurable
add experimental build option AUTOPICKUP_EXCEPTIONS for filtering pickup of add experimental build option AUTOPICKUP_EXCEPTIONS for filtering pickup of
items by pattern matching against their xname() description items by pattern matching against their xname() description
include version number in paniclog entries
Platform- and/or Interface-Specific New Features Platform- and/or Interface-Specific New Features
+1
View File
@@ -2154,6 +2154,7 @@ E boolean NDECL(gd_sound);
/* ### version.c ### */ /* ### version.c ### */
E char *FDECL(version_string, (char *));
E char *FDECL(getversionstring, (char *)); E char *FDECL(getversionstring, (char *));
E int NDECL(doversion); E int NDECL(doversion);
E int NDECL(doextversion); E int NDECL(doextversion);
+8 -5
View File
@@ -2267,20 +2267,23 @@ const char *dir;
/*ARGSUSED*/ /*ARGSUSED*/
void void
paniclog(why, s) paniclog(type, reason)
const char* why; const char *type; /* panic, impossible, trickery */
const char* s; const char *reason; /* explanation */
{ {
#ifdef PANICLOG #ifdef PANICLOG
FILE *lfile; FILE *lfile;
char buf[BUFSZ];
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX); lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
if (lfile) { if (lfile) {
(void) fprintf(lfile, "%08ld: %s %s\n", (void) fprintf(lfile, "%s %08ld: %s %s\n",
yyyymmdd((time_t)0L), why, s); version_string(buf), yyyymmdd((time_t)0L),
type, reason);
(void) fclose(lfile); (void) fclose(lfile);
} }
#endif /* PANICLOG */ #endif /* PANICLOG */
return;
} }
/* ---------- END PANIC/IMPOSSIBLE LOG ----------- */ /* ---------- END PANIC/IMPOSSIBLE LOG ----------- */
+13 -5
View File
@@ -1,4 +1,4 @@
/* SCCS Id: @(#)version.c 3.4 2003/02/19 */ /* SCCS Id: @(#)version.c 3.4 2003/11/22 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -16,17 +16,25 @@
/* #define BETA_INFO "" */ /* #define BETA_INFO "" */
/* fill and return the given buffer with the nethack version string */ /* fill buffer with short version (so caller can avoid including date.h) */
char *
version_string(buf)
char *buf;
{
return strcpy(buf, VERSION_STRING);
}
/* fill and return the given buffer with the long nethack version string */
char * char *
getversionstring(buf) getversionstring(buf)
char *buf; char *buf;
{ {
Strcpy(buf, VERSION_ID); Strcpy(buf, VERSION_ID);
#if defined(BETA) && defined(BETA_INFO) #if defined(BETA) && defined(BETA_INFO)
Sprintf(eos(buf), " %s", BETA_INFO); Sprintf(eos(buf), " %s", BETA_INFO);
#endif #endif
#if defined(RUNTIME_PORT_ID) #if defined(RUNTIME_PORT_ID)
append_port_id(buf); append_port_id(buf);
#endif #endif
return buf; return buf;
} }