ARGSUSED*/
| 2798 | |
| 2799 | /*ARGSUSED*/ |
| 2800 | void |
| 2801 | paniclog( |
| 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 | |
| 2835 | void |
| 2836 | testinglog(const char *filenm, /* ad hoc file name */ |
no test coverage detected