home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume11 / watcher / part01 / pp_change.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-09-27  |  813 b   |  45 lines

  1. /*
  2.    pp_change: pretty print the change format.
  3.  
  4.    Kenneth Ingham
  5.  
  6.    Copyright (C) 1987 The University of New Mexico
  7. */
  8.  
  9. #include "defs.h"
  10.  
  11. pp_change(cf)
  12. struct change_fmt_st *cf;
  13. {
  14.     while (cf != NULL) {
  15.         switch(cf->type) {
  16.             case PERCENT:
  17.                 printf("\t\t%s %5.2f %%", cf->name,
  18.                     cf->fmt.percent*100);
  19.                 break;
  20.             case ABSOLUTE:
  21.                 printf("\t\t%s %6.2f", cf->name,
  22.                     cf->fmt.abs_amount);
  23.                 break;
  24.             case MAX_MIN:
  25.                 printf("\t\t%s %6.2f %6.2f", cf->name,
  26.                     cf->fmt.max_min.min,
  27.                     cf->fmt.max_min.max);
  28.                 break;
  29.             case STRING:
  30.                 printf("\t\t%s \"%s\"", cf->name,
  31.                     cf->fmt.str_value);
  32.                 break;
  33.             default:
  34.                 printf("Impossible change format type: %d\n",
  35.                     cf->type);
  36.                 break;
  37.         }
  38.         if (cf->next != NULL)
  39.             printf(" ;\n");
  40.         else
  41.             printf(" .\n");
  42.         cf = cf->next;
  43.     }
  44. }
  45.