home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / Watcher / pp_out.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-07-26  |  782 b   |  42 lines

  1. /*
  2.    pp_out: pretty print the output of command structure.
  3.  
  4.    Kenneth Ingham
  5.  
  6.    Copyright (C) 1987 The University of New Mexico
  7. */
  8.  
  9. #include "defs.h"
  10. #include "y.tab.h"
  11.  
  12. pp_out(of)
  13. struct out_fmt_st *of;
  14. {
  15.     struct rel_out_st *rp;
  16.     struct col_out_st *cp;
  17.     char tchar();
  18.  
  19.     switch(of->type) {
  20.         case RELATIVE:
  21.             rp = of->out_fmt.rel_fmt;
  22.             while (rp != NULL) {
  23.                 printf(" %d %s %%%c", rp->field, rp->name,
  24.                     tchar(rp->type));
  25.                 rp = rp->next;
  26.             }
  27.             break;
  28.         case COLUMN:
  29.             cp = of->out_fmt.col_fmt;
  30.             while (cp != NULL) {
  31.                 printf(" %d-%d %s %%%c", cp->start, cp->end,
  32.                     cp->name, tchar(cp->type));
  33.                 cp = cp->next;
  34.             }
  35.             break;
  36.         default:
  37.             fprintf(stderr, "Impossible value for output ");
  38.             fprintf(stderr, "format.  type: %d\n", of->type);
  39.             break;
  40.     }
  41. }
  42.