home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / octa21fs.zip / octave / f2c / libf77 / sig_die.c < prev    next >
C/C++ Source or Header  |  2000-01-15  |  583b  |  38 lines

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