]> granicus.if.org Git - nethack/commitdiff
paniclog enhancement
authornethack.rankin <nethack.rankin>
Sun, 23 Nov 2003 10:01:58 +0000 (10:01 +0000)
committernethack.rankin <nethack.rankin>
Sun, 23 Nov 2003 10:01:58 +0000 (10:01 +0000)
     Include the version number in paniclog entries, so there'll be more
information whenever someone forwards them to us.

doc/fixes34.3
include/extern.h
src/files.c
src/version.c

index 0b15b81d7c9434ab318406680703e2a3b19b505f..867b689bef0fe2e219128781a9c680b8821463f1 100644 (file)
@@ -126,6 +126,7 @@ extend autodig to work downwards via '>'
 make attribute that is used to distinguish headings in a menu configurable
 add experimental build option AUTOPICKUP_EXCEPTIONS for filtering pickup of
        items by pattern matching against their xname() description
+include version number in paniclog entries
 
 
 Platform- and/or Interface-Specific New Features
index 6a59bb7616dac2b769781d90ac5cd5ec030b2e01..dd67363b5f480f09f314ccccd5b633b8f2b6150d 100644 (file)
@@ -2154,6 +2154,7 @@ E boolean NDECL(gd_sound);
 
 /* ### version.c ### */
 
+E char *FDECL(version_string, (char *));
 E char *FDECL(getversionstring, (char *));
 E int NDECL(doversion);
 E int NDECL(doextversion);
index 5113cbb8696b1c74133d0852424ce92759aa57a2..1cca1ca06baf105cc7b77f3d23ef60283a2b79b7 100644 (file)
@@ -2267,20 +2267,23 @@ const char *dir;
 
 /*ARGSUSED*/
 void
-paniclog(why, s)
-const char* why;
-const char* s;
+paniclog(type, reason)
+const char *type;      /* panic, impossible, trickery */
+const char *reason;    /* explanation */
 {
 #ifdef PANICLOG
        FILE *lfile;
+       char buf[BUFSZ];
 
        lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
        if (lfile) {
-           (void) fprintf(lfile, "%08ld: %s %s\n",
-                          yyyymmdd((time_t)0L), why, s);
+           (void) fprintf(lfile, "%s %08ld: %s %s\n",
+                          version_string(buf), yyyymmdd((time_t)0L),
+                          type, reason);
            (void) fclose(lfile);
        }
 #endif /* PANICLOG */
+       return;
 }
 
 /* ----------  END PANIC/IMPOSSIBLE LOG ----------- */
index 4712ff8da4f2bef5bfce69aff4626d84952aa93b..50243c0bd4d44c8d89c3d17e736e2a7dc77aac30 100644 (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. */
 /* NetHack may be freely redistributed.  See license for details. */
 
 
 /* #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 *
 getversionstring(buf)
 char *buf;
 {
-        Strcpy(buf, VERSION_ID);
+       Strcpy(buf, VERSION_ID);
 #if defined(BETA) && defined(BETA_INFO)
-        Sprintf(eos(buf), " %s", BETA_INFO);
+       Sprintf(eos(buf), " %s", BETA_INFO);
 #endif
 #if defined(RUNTIME_PORT_ID)
-        append_port_id(buf);
+       append_port_id(buf);
 #endif
        return buf;
 }