Files
nethack/util/panic.c
Sean Hunt 97d6fade74 Reformat all C files.
I'll push a formatting guide at some point. There may still be
outstanding changes, but please feel free to resolve those as you arrive
a them.

To the best of my knowledge, there is no changes to the actual code
content, but the formatter does have the occasional bug. If you run into
an issue, please fix it!
2015-05-09 13:43:16 -04:00

65 lines
1.5 KiB
C

/* NetHack 3.6 panic.c $NHDT-Date: 1431192770 2015/05/09 17:32:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.7 $ */
/* NetHack 3.6 panic.c $Date: 2009/05/06 10:54:39 $ $Revision: 1.4 $ */
/* SCCS Id: @(#)panic.c 3.5 1994/03/02 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
/*
* This code was adapted from the code in end.c to run in a standalone
* mode for the makedefs / drg code.
*/
#define NEED_VARARGS
#include "config.h"
#ifdef AZTEC
#define abort() exit()
#endif
#ifdef VMS
extern void NDECL(vms_abort);
#endif
/*VARARGS1*/
boolean panicking;
void VDECL(panic, (char *, ...));
void panic
VA_DECL(char *, str)
VA_START(str);
VA_INIT(str, char *);
if (panicking++)
#ifdef SYSV
(void)
#endif
abort(); /* avoid loops - this should never happen*/
(void) fputs(" ERROR: ", stderr);
Vfprintf(stderr, str, VA_ARGS);
(void) fflush(stderr);
#if defined(UNIX) || defined(VMS)
#ifdef SYSV
(void)
#endif
abort(); /* generate core dump */
#endif
VA_END();
exit(EXIT_FAILURE); /* redundant */
return;
}
#ifdef ALLOCA_HACK
/*
* In case bison-generated foo_yacc.c tries to use alloca(); if we don't
* have it then just use malloc() instead. This may not work on some
* systems, but they should either use yacc or get a real alloca routine.
*/
long *
alloca(cnt)
unsigned cnt;
{
return cnt ? alloc(cnt) : (long *) 0;
}
#endif
/*panic.c*/