Sanity check for returning Mjollnir animation
[aNetHack.git] / util / panic.c
blobf5a0837d013b50e1596a314d31ea9f58e3b918e0
1 /* NetHack 3.6 panic.c $NHDT-Date: 1448210012 2015/11/22 16:33:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* NetHack may be freely redistributed. See license for details. */
5 /*
6 * This code was adapted from the code in end.c to run in a standalone
7 * mode for the makedefs / drg code.
8 */
10 #define NEED_VARARGS
11 #include "config.h"
13 #ifdef AZTEC
14 #define abort() exit()
15 #endif
16 #ifdef VMS
17 extern void NDECL(vms_abort);
18 #endif
20 /*VARARGS1*/
21 boolean panicking;
22 void VDECL(panic, (char *, ...));
24 void panic
25 VA_DECL(char *, str)
27 VA_START(str);
28 VA_INIT(str, char *);
29 if (panicking++)
30 #ifdef SYSV
31 (void)
32 #endif
33 abort(); /* avoid loops - this should never happen*/
35 (void) fputs(" ERROR: ", stderr);
36 Vfprintf(stderr, str, VA_ARGS);
37 (void) fflush(stderr);
38 #if defined(UNIX) || defined(VMS)
39 #ifdef SYSV
40 (void)
41 #endif
42 abort(); /* generate core dump */
43 #endif
44 VA_END();
45 exit(EXIT_FAILURE); /* redundant */
48 #ifdef ALLOCA_HACK
50 * In case bison-generated foo_yacc.c tries to use alloca(); if we don't
51 * have it then just use malloc() instead. This may not work on some
52 * systems, but they should either use yacc or get a real alloca routine.
54 long *
55 alloca(cnt)
56 unsigned cnt;
58 return cnt ? alloc(cnt) : (long *) 0;
60 #endif
62 /*panic.c*/