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

  1. *****Listing 3*****
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. #define SET 1
  7. #define CLEAR 0
  8.  
  9. void eh(void);
  10.  
  11. struct status_flags {
  12.     unsigned f0 : 1;
  13.     unsigned f1 : 1;
  14.     unsigned f2 : 1;
  15.     unsigned f3 : 1;
  16. } flags = {
  17.     CLEAR, CLEAR, CLEAR, CLEAR
  18. };
  19.  
  20. main()
  21. {
  22.     atexit(eh);
  23.     flags.f2 = 1;
  24.     flags.f3 = 1;
  25. }
  26.  
  27. void eh(void)
  28. {
  29.     if (flags.f0 == SET)
  30.         printf("f0 needs cleanup\n");
  31.     if (flags.f1 == SET)
  32.         printf("f1 needs cleanup\n");
  33.     if (flags.f2 == SET)
  34.         printf("f2 needs cleanup\n");
  35.     if (flags.f3 == SET)
  36.         printf("f3 needs cleanup\n");
  37. }
  38.  
  39. f2 needs cleanup
  40. f3 needs cleanup
  41.  
  42.