home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / f2csrc.zip / f2csrc / libF77 / sig_die.c < prev    next >
C/C++ Source or Header  |  1994-07-28  |  679b  |  46 lines

  1. #include "stdio.h"
  2. #include "signal.h"
  3.  
  4. #ifndef SIGIOT
  5. #ifdef SIGABRT
  6. #define SIGIOT SIGABRT
  7. #endif
  8. #endif
  9.  
  10. #ifdef KR_headers
  11. void sig_die(s, kill) register char *s; int kill;
  12. #else
  13. #include "stdlib.h"
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17.  extern void f_exit(void);
  18.  
  19. void sig_die(register char *s, int kill)
  20. #endif
  21. {
  22.     /* print error message, then clear buffers */
  23.     fprintf(stderr, "%s\n", s);
  24.  
  25.     if(kill)
  26.         {
  27.         fflush(stderr);
  28.         f_exit();
  29.         fflush(stderr);
  30.         /* now get a core */
  31. #ifdef SIGIOT
  32.         signal(SIGIOT, SIG_DFL);
  33. #endif
  34.         abort();
  35.         }
  36.     else {
  37. #ifdef NO_ONEXIT
  38.         f_exit();
  39. #endif
  40.         exit(1);
  41.         }
  42.     }
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46.