Annotation of src/usr.bin/mk_cmds/options.c, Revision 1.1
1.1 ! downsj 1: /* $OpenBSD: options.c,v 1.1.1.1 1995/12/14 06:52:47 tholo Exp $ */
! 2:
! 3: /*-
! 4: * Copyright 1987, 1988 by the Student Information Processing Board
! 5: * of the Massachusetts Institute of Technology
! 6: *
! 7: * Permission to use, copy, modify, and distribute this software
! 8: * and its documentation for any purpose and without fee is
! 9: * hereby granted, provided that the above copyright notice
! 10: * appear in all copies and that both that copyright notice and
! 11: * this permission notice appear in supporting documentation,
! 12: * and that the names of M.I.T. and the M.I.T. S.I.P.B. not be
! 13: * used in advertising or publicity pertaining to distribution
! 14: * of the software without specific, written prior permission.
! 15: * M.I.T. and the M.I.T. S.I.P.B. make no representations about
! 16: * the suitability of this software for any purpose. It is
! 17: * provided "as is" without express or implied warranty.
! 18: */
! 19:
! 20: #include <stdio.h>
! 21: #define NO_SS_ERR_H
! 22: #include <ss/ss.h>
! 23:
! 24: struct option {
! 25: char *text;
! 26: long value;
! 27: };
! 28:
! 29: static struct option options[] = {
! 30: { "dont_list", SS_OPT_DONT_LIST },
! 31: { "^list", SS_OPT_DONT_LIST },
! 32: { "dont_summarize", SS_OPT_DONT_SUMMARIZE },
! 33: { "^summarize", SS_OPT_DONT_SUMMARIZE },
! 34: { (char *)NULL, 0 }
! 35: };
! 36:
! 37: long
! 38: flag_val(string)
! 39: register char *string;
! 40: {
! 41: register struct option *opt;
! 42: for (opt = options; opt->text; opt++)
! 43: if (!strcmp(opt->text, string))
! 44: return(opt->value);
! 45: return(0);
! 46: }