xref: /titanic_52/usr/src/cmd/ipf/lib/common/optvalue.c (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright (C) 1993-2001 by Darren Reed.
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * See the IPFILTER.LICENCE file for details on licencing.
5*7c478bd9Sstevel@tonic-gate  *
6*7c478bd9Sstevel@tonic-gate  * $Id: optvalue.c,v 1.2 2002/01/28 06:50:47 darrenr Exp $
7*7c478bd9Sstevel@tonic-gate  */
8*7c478bd9Sstevel@tonic-gate #include "ipf.h"
9*7c478bd9Sstevel@tonic-gate 
10*7c478bd9Sstevel@tonic-gate 
11*7c478bd9Sstevel@tonic-gate u_32_t getoptbyname(optname)
12*7c478bd9Sstevel@tonic-gate char *optname;
13*7c478bd9Sstevel@tonic-gate {
14*7c478bd9Sstevel@tonic-gate 	struct ipopt_names *io;
15*7c478bd9Sstevel@tonic-gate 
16*7c478bd9Sstevel@tonic-gate 	for (io = ionames; io->on_name; io++)
17*7c478bd9Sstevel@tonic-gate 		if (!strcasecmp(optname, io->on_name))
18*7c478bd9Sstevel@tonic-gate 			return io->on_bit;
19*7c478bd9Sstevel@tonic-gate 	return -1;
20*7c478bd9Sstevel@tonic-gate }
21*7c478bd9Sstevel@tonic-gate 
22*7c478bd9Sstevel@tonic-gate 
23*7c478bd9Sstevel@tonic-gate u_32_t getoptbyvalue(optval)
24*7c478bd9Sstevel@tonic-gate int optval;
25*7c478bd9Sstevel@tonic-gate {
26*7c478bd9Sstevel@tonic-gate 	struct ipopt_names *io;
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate 	for (io = ionames; io->on_name; io++)
29*7c478bd9Sstevel@tonic-gate 		if (io->on_value == optval)
30*7c478bd9Sstevel@tonic-gate 			return io->on_bit;
31*7c478bd9Sstevel@tonic-gate 	return -1;
32*7c478bd9Sstevel@tonic-gate }
33