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