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

  1. /*
  2.    find_of: find the output format corresponding for the field whose
  3.    name we are given.
  4.  
  5.    Kenneth Ingham
  6.  
  7.    Copyright (C) 1987 The University of New Mexico
  8. */
  9.  
  10. #include "defs.h"
  11.  
  12. find_of(type, name, of_head, of)
  13. int type;
  14. union out_fmt_u of_head, *of;
  15. char *name;
  16. {
  17.     struct rel_out_st *rf;
  18.     struct col_out_st *cf;
  19.  
  20.     switch(type) {
  21.     case RELATIVE:
  22.         for (rf=of_head.rel_fmt; rf; rf=rf->next)
  23.             if (strcmp(name, rf->name) == 0) {
  24.                 (*of).rel_fmt = rf;
  25.                 return True;
  26.             }
  27.         break;
  28.     case COLUMN:
  29.         for (cf=of_head.col_fmt; cf; cf=cf->next)
  30.             if (strcmp(name, cf->name) == 0) {
  31.                 (*of).col_fmt = cf;
  32.                 return True;
  33.             }
  34.         break;
  35.     default:
  36.         fprintf(stderr,"internal error; unknown type in find_of\n");
  37.         exit(1);
  38.     }
  39.  
  40.     return False;
  41. }
  42.