xref: /freebsd/sbin/ipf/libipf/printportcmp.c (revision 2a63c3be158216222d89a073dcbd6a72ee4aab5a)
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
printportcmp(int pr,frpcmp_t * frp)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