MCPcopy Create free account
hub / github.com/NetHack/NetHack / paniclog

Function paniclog

src/files.c:2800–2833  ·  view source on GitHub ↗

ARGSUSED*/

Source from the content-addressed store, hash-verified

2798
2799/*ARGSUSED*/
2800void
2801paniclog(
2802 const char *type, /* panic, impossible, trickery, [lua] */
2803 const char *reason) /* explanation */
2804{
2805#ifdef PANICLOG
2806 FILE *lfile;
2807
2808 if (!program_state.in_paniclog) {
2809 program_state.in_paniclog = 1;
2810 lfile = fopen_datafile(PANICLOG, "a", TROUBLEPREFIX);
2811 if (lfile) {
2812#ifdef PANICLOG_FMT2
2813 (void) fprintf(lfile, "%ld %s: %s %s\n",
2814 ubirthday, (svp.plname[0] ? svp.plname : "(none)"),
2815 type, reason);
2816#else
2817 char buf[BUFSZ];
2818 time_t now = getnow();
2819 int uid = getuid();
2820 char playmode = wizard ? 'D' : discover ? 'X' : '-';
2821
2822 (void) fprintf(lfile, "%s %08ld %06ld %d %c: %s %s\n",
2823 version_string(buf, sizeof buf),
2824 yyyymmdd(now), hhmmss(now),
2825 uid, playmode, type, reason);
2826#endif /* !PANICLOG_FMT2 */
2827 (void) fclose(lfile);
2828 }
2829 program_state.in_paniclog = 0;
2830 }
2831#endif /* PANICLOG */
2832 return;
2833}
2834
2835void
2836testinglog(const char *filenm, /* ad hoc file name */

Callers 15

status_sanity_checkFunction · 0.85
check_windowdataFunction · 0.85
render_statusFunction · 0.85
curses_break_strFunction · 0.85
curses_str_remainderFunction · 0.85
sys_random_seedFunction · 0.85
sys_random_seedFunction · 0.85
sys_random_seedFunction · 0.85
savebonesFunction · 0.85
VA_DECLFunction · 0.85
doneFunction · 0.85
placebcFunction · 0.85

Calls 8

fprintfFunction · 0.85
getnowFunction · 0.85
getuidFunction · 0.85
version_stringFunction · 0.85
yyyymmddFunction · 0.85
hhmmssFunction · 0.85
fcloseFunction · 0.85
fopen_datafileFunction · 0.70

Tested by

no test coverage detected