Sync usage with man page.
[netbsd-mini2440.git] / dist / ipf / lib / optprint.c
blobd933b993ace6352eb86ae4f28907d6ad21569f52
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2000-2005 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: optprint.c,v 1.6.4.2 2006/06/16 17:21:08 darrenr Exp
9 */
10 #include "ipf.h"
13 void optprint(sec, optmsk, optbits)
14 u_short *sec;
15 u_long optmsk, optbits;
17 u_short secmsk = sec[0], secbits = sec[1];
18 struct ipopt_names *io, *so;
19 char *s;
21 s = " opt ";
22 for (io = ionames; io->on_name; io++)
23 if ((io->on_bit & optmsk) &&
24 ((io->on_bit & optmsk) == (io->on_bit & optbits))) {
25 if ((io->on_value != IPOPT_SECURITY) ||
26 (!secmsk && !secbits)) {
27 printf("%s%s", s, io->on_name);
29 * Because the ionames table has this entry
30 * twice.
32 if (io->on_value == IPOPT_SECURITY)
33 io++;
34 s = ",";
39 if (secmsk & secbits) {
40 printf("%ssec-class", s);
41 s = " ";
42 for (so = secclass; so->on_name; so++)
43 if ((secmsk & so->on_bit) &&
44 ((so->on_bit & secmsk) == (so->on_bit & secbits))) {
45 printf("%s%s", s, so->on_name);
46 s = ",";
50 if ((optmsk && (optmsk != optbits)) ||
51 (secmsk && (secmsk != secbits))) {
52 s = " ";
53 printf(" not opt");
54 if (optmsk != optbits) {
55 for (io = ionames; io->on_name; io++)
56 if ((io->on_bit & optmsk) &&
57 ((io->on_bit & optmsk) !=
58 (io->on_bit & optbits))) {
59 if ((io->on_value != IPOPT_SECURITY) ||
60 (!secmsk && !secbits)) {
61 printf("%s%s", s, io->on_name);
62 s = ",";
63 if (io->on_value ==
64 IPOPT_SECURITY)
65 io++;
66 } else
67 io++;
71 if (secmsk != secbits) {
72 printf("%ssec-class", s);
73 s = " ";
74 for (so = secclass; so->on_name; so++)
75 if ((so->on_bit & secmsk) &&
76 ((so->on_bit & secmsk) !=
77 (so->on_bit & secbits))) {
78 printf("%s%s", s, so->on_name);
79 s = ",";