home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / Watcher / find_of.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-08-02  |  866 b   |  44 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(name, of_head, of)
  13. struct out_fmt_st *of_head, *of;
  14. char *name;
  15. {
  16.     struct rel_out_st *rf;
  17.     struct col_out_st *cf;
  18.  
  19.     of->type = of_head->type;
  20.     switch(of_head->type) {
  21.         case RELATIVE:
  22.             for (rf=of_head->out_fmt.rel_fmt; rf; rf=rf->next)
  23.                 if (strcmp(name, rf->name) == 0) {
  24.                     of->out_fmt.rel_fmt = rf;
  25.                     return True;
  26.                 }
  27.             break;
  28.         case COLUMN:
  29.             for (cf=of_head->out_fmt.col_fmt; cf; cf=cf->next)
  30.                 if (strcmp(name, cf->name) == 0) {
  31.                     of->out_fmt.col_fmt = cf;
  32.                     return True;
  33.                 }
  34.             break;
  35.         default:
  36.             fprintf(stderr, "internal error; unknown type %d",
  37.                 of_head->type);
  38.             fprintf(stderr, " in find_of\n");
  39.             exit(1);
  40.     }
  41.  
  42.     return False;
  43. }
  44.