xref: /illumos-gate/usr/src/cmd/ipf/lib/optvalue.c (revision f3ac6781)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * Copyright (C) 1993-2001 by Darren Reed.
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * See the IPFILTER.LICENCE file for details on licencing.
57c478bd9Sstevel@tonic-gate  *
67c478bd9Sstevel@tonic-gate  * $Id: optvalue.c,v 1.2 2002/01/28 06:50:47 darrenr Exp $
77c478bd9Sstevel@tonic-gate  */
87c478bd9Sstevel@tonic-gate #include "ipf.h"
97c478bd9Sstevel@tonic-gate 
107c478bd9Sstevel@tonic-gate 
getoptbyname(optname)117c478bd9Sstevel@tonic-gate u_32_t getoptbyname(optname)
127c478bd9Sstevel@tonic-gate char *optname;
137c478bd9Sstevel@tonic-gate {
147c478bd9Sstevel@tonic-gate 	struct ipopt_names *io;
157c478bd9Sstevel@tonic-gate 
167c478bd9Sstevel@tonic-gate 	for (io = ionames; io->on_name; io++)
177c478bd9Sstevel@tonic-gate 		if (!strcasecmp(optname, io->on_name))
187c478bd9Sstevel@tonic-gate 			return io->on_bit;
197c478bd9Sstevel@tonic-gate 	return -1;
207c478bd9Sstevel@tonic-gate }
217c478bd9Sstevel@tonic-gate 
227c478bd9Sstevel@tonic-gate 
getoptbyvalue(optval)237c478bd9Sstevel@tonic-gate u_32_t getoptbyvalue(optval)
247c478bd9Sstevel@tonic-gate int optval;
257c478bd9Sstevel@tonic-gate {
267c478bd9Sstevel@tonic-gate 	struct ipopt_names *io;
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate 	for (io = ionames; io->on_name; io++)
297c478bd9Sstevel@tonic-gate 		if (io->on_value == optval)
307c478bd9Sstevel@tonic-gate 			return io->on_bit;
317c478bd9Sstevel@tonic-gate 	return -1;
327c478bd9Sstevel@tonic-gate }
33