xref: /illumos-gate/usr/src/cmd/ipf/lib/printportcmp.c (revision f3ac678143127d4c6c1793fadabb5ded04e127b6)
1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: printportcmp.c,v 1.7 2003/02/16 02:31:05 darrenr Exp $
7  */
8 
9 #include "ipf.h"
10 
11 
printportcmp(pr,frp)12 void	printportcmp(pr, frp)
13 int	pr;
14 frpcmp_t	*frp;
15 {
16 	static char *pcmp1[] = { "*", "=", "!=", "<", ">", "<=", ">=",
17 				 "<>", "><", ":" };
18 
19 	if (frp->frp_cmp == FR_INRANGE || frp->frp_cmp == FR_OUTRANGE)
20 		printf(" port %d %s %d", frp->frp_port,
21 			     pcmp1[frp->frp_cmp], frp->frp_top);
22 	else if (frp->frp_cmp == FR_INCRANGE)
23 		printf(" port %d:%d", frp->frp_port, frp->frp_top);
24 	else
25 		printf(" port %s %s", pcmp1[frp->frp_cmp],
26 			     portname(pr, frp->frp_port));
27 }
28