[comp.sources.games.bugs] Avoiding Nethack core dumps

wietse@wzv.win.tue.nl (Wietse Z. Venema) (04/14/90)

shevett@mccc.uucp (Dave Shevett) writes:

>Is there any 'quick and dirty' thing to stop [core dumps] from happening?  

Yes there is, and most of the required code is already part of the program.
In order to survive imminent core dumps, just add a few lines with

	(void) signal(SIGSEGV, (SIG_RET_TYPE) hangup);
	(void) signal(SIGBUS, (SIG_RET_TYPE) hangup);

near the `signal(SIGHUP, (SIG_RET_TYPE) hangup);' statement.  The change causes
the program to save the game and terminate cleanly, instead of dumping core.