freebsd-dev/contrib/libf2c/libF77/sig_die.c

38 lines
541 B
C
Raw Normal View History

1999-09-18 10:51:31 +00:00
#include <stdio.h>
#include <signal.h>
#ifndef SIGIOT
#ifdef SIGABRT
#define SIGIOT SIGABRT
#endif
#endif
#include <stdlib.h>
2003-07-11 03:42:19 +00:00
extern void f_exit (void);
1999-09-18 10:51:31 +00:00
2003-07-11 03:42:19 +00:00
void
sig_die (register char *s, int kill)
1999-09-18 10:51:31 +00:00
{
2003-07-11 03:42:19 +00:00
/* print error message, then clear buffers */
fprintf (stderr, "%s\n", s);
1999-09-18 10:51:31 +00:00
2003-07-11 03:42:19 +00:00
if (kill)
{
fflush (stderr);
f_exit ();
fflush (stderr);
/* now get a core */
1999-09-18 10:51:31 +00:00
#ifdef SIGIOT
2003-07-11 03:42:19 +00:00
signal (SIGIOT, SIG_DFL);
1999-09-18 10:51:31 +00:00
#endif
2003-07-11 03:42:19 +00:00
abort ();
}
else
{
1999-09-18 10:51:31 +00:00
#ifdef NO_ONEXIT
2003-07-11 03:42:19 +00:00
f_exit ();
1999-09-18 10:51:31 +00:00
#endif
2003-07-11 03:42:19 +00:00
exit (1);
}
1999-09-18 10:51:31 +00:00
}