xref: /freebsd/sbin/ipf/libipf/printportcmp.c (revision 02e9120893770924227138ba49df1edb3896112a)
1 
2 /*
3  * Copyright (C) 2012 by Darren Reed.
4  *
5  * See the IPFILTER.LICENCE file for details on licencing.
6  *
7  * $Id$
8  */
9 
10 #include "ipf.h"
11 
12 
13 void
14 printportcmp(int pr, 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