home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s300 / 1.ddi / CHAP3 / PANIC.C < prev    next >
Encoding:
C/C++ Source or Header  |  1988-05-02  |  1.0 KB  |  44 lines

  1. /***********************************************************************
  2.  
  3. FILE
  4.     panic.c  -  abort execution
  5.  
  6. ROUTINES
  7.     panic  -  print error message and die
  8.  
  9. REMARKS
  10.     When using interrupts on the IBM PC, one should restore interrupts
  11.     to their default states before performing an error exit.
  12.  
  13.     This module assumes that the xignal package was used for interrupts
  14.     and uses a xignal() call to restore all affected interrupts before
  15.     terminating.
  16.  
  17. LAST UPDATE
  18.     25 January 1988
  19.         calls setalarm() also
  20.  
  21.     Copyright(c) 1985-1988  D.M. Auslander and C.H. Tham
  22.  
  23. ***********************************************************************/
  24.  
  25. #include "envir.h"
  26. #include "xignal.h"
  27. #include "alarm.h"
  28.  
  29.  
  30. void panic(mesg)
  31. char *mesg;
  32. {
  33.  
  34.     xignal(XIGALL, XIG_IGN);                /* ignore all signals */
  35.  
  36.     printf("\nABORT - %s\n\n\07", mesg);    /* print error message */
  37.  
  38.     xignal(XIGALL, XIG_DFL);                /* restore defaults */
  39.  
  40.     setalarm(-1.0);                         /* restore clock */
  41.  
  42. }
  43.  
  44.