home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_06 / 8n06031a < prev    next >
Text File  |  1990-04-18  |  503b  |  38 lines

  1. *****Listing 5*****
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <signal.h>
  6. #include <assert.h>
  7.  
  8. void eh(void);
  9. void abort_hand(void);
  10.  
  11. main()
  12. {
  13.     char c;
  14.  
  15.     atexit(eh);
  16.     if (signal(SIGABRT, abort_hand) == SIG_ERR) {
  17.         printf("Can't register abort_hand\n");
  18.         exit(1);
  19.     }
  20.  
  21.     printf("Enter A (abort), E (exit): ");
  22.     c = getchar();
  23.  
  24.     assert(c != 'A');
  25. }
  26.  
  27. void eh(void)
  28. {
  29.     printf("Inside eh\n");
  30. }
  31.  
  32. void abort_hand(void)
  33. {
  34.     printf("Inside abort_hand\n");
  35.     exit(2);
  36. }
  37.  
  38.