paniclog prefix (trunk only)

Extend the identifying information used to prefix paniclog entries
from version + date to version + date + time + userid + mode (where mode
is 'D' for wizard mode, 'X' for discover mode, and '-' for normal play).

     hacklib.c ended up getting more of a revision than I intended, but
the date/time handling routines now have less clutter.  I hope I didn't
break anything in the process.
This commit is contained in:
nethack.rankin
2006-10-10 05:47:04 +00:00
parent ab947c6b65
commit 35920f24d5
4 changed files with 65 additions and 36 deletions

View File

@@ -927,10 +927,9 @@ create_savefile()
the default for non-privileged users, but for priv'd users the
file will be owned by the directory's owner instead of the user.
*/
# ifdef getuid /*(see vmsunix.c)*/
# undef getuid
# endif
# undef getuid
(void) chown(fq_save, getuid(), getgid());
# define getuid() vms_getuid()
# endif /* VMS && !SECURE */
#endif /* MICRO */
@@ -2776,8 +2775,14 @@ const char *reason; /* explanation */
program_state.in_paniclog = 1;
lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
if (lfile) {
(void) fprintf(lfile, "%s %08ld: %s %s\n",
version_string(buf), yyyymmdd((time_t)0L),
time_t now = getnow();
int uid = getuid();
char playmode = wizard ? 'D' : discover ? 'X' : '-';
(void) fprintf(lfile, "%s %08ld %06ld %d %c: %s %s\n",
version_string(buf),
yyyymmdd(now), hhmmss(now),
uid, playmode,
type, reason);
(void) fclose(lfile);
}