1998-02-01 09:37:08 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
|
|
#ifndef SIGIOT
|
|
|
|
#ifdef SIGABRT
|
|
|
|
#define SIGIOT SIGABRT
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
2002-06-01 20:38:32 +08:00
|
|
|
extern void f_exit (void);
|
1998-02-01 09:37:08 +08:00
|
|
|
|
2002-06-01 20:38:32 +08:00
|
|
|
void
|
|
|
|
sig_die (register char *s, int kill)
|
1998-02-01 09:37:08 +08:00
|
|
|
{
|
2002-06-01 20:38:32 +08:00
|
|
|
/* print error message, then clear buffers */
|
|
|
|
fprintf (stderr, "%s\n", s);
|
1998-02-01 09:37:08 +08:00
|
|
|
|
2002-06-01 20:38:32 +08:00
|
|
|
if (kill)
|
|
|
|
{
|
|
|
|
fflush (stderr);
|
|
|
|
f_exit ();
|
|
|
|
fflush (stderr);
|
|
|
|
/* now get a core */
|
1998-02-01 09:37:08 +08:00
|
|
|
#ifdef SIGIOT
|
2002-06-01 20:38:32 +08:00
|
|
|
signal (SIGIOT, SIG_DFL);
|
1998-02-01 09:37:08 +08:00
|
|
|
#endif
|
2002-06-01 20:38:32 +08:00
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1998-02-01 09:37:08 +08:00
|
|
|
#ifdef NO_ONEXIT
|
2002-06-01 20:38:32 +08:00
|
|
|
f_exit ();
|
1998-02-01 09:37:08 +08:00
|
|
|
#endif
|
2002-06-01 20:38:32 +08:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
}
|