Couple of extra nethack->anethack
[aNetHack.git] / util / panic.c
blobf5302c578691ba67d2becda9c6b770a5998d0187
1 /* aNetHack 0.0.1 panic.c $ANH-Date: 1448210012 2015/11/22 16:33:32 $ $ANH-Branch: master $:$ANH-Revision: 1.10 $ */
2 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
3 /* aNetHack 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*/