xref: /freebsd/sbin/ipf/libipf/printportcmp.c (revision 716fd348e01c5f2ba125f878a634a753436c2994)
1 /*	$FreeBSD$	*/
2 
3 /*
4  * Copyright (C) 2012 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * $Id$
9  */
10 
11 #include "ipf.h"
12 
13 
14 void
15 printportcmp(int pr, frpcmp_t *frp)
16 {
17 	static char *pcmp1[] = { "*", "=", "!=", "<", ">", "<=", ">=",
18 				 "<>", "><", ":" };
19 
20 	if (frp->frp_cmp == FR_INRANGE || frp->frp_cmp == FR_OUTRANGE)
21 		PRINTF(" port %d %s %d", frp->frp_port,
22 			     pcmp1[frp->frp_cmp], frp->frp_top);
23 	else if (frp->frp_cmp == FR_INCRANGE)
24 		PRINTF(" port %d:%d", frp->frp_port, frp->frp_top);
25 	else
26 		PRINTF(" port %s %s", pcmp1[frp->frp_cmp],
27 			     portname(pr, frp->frp_port));
28 }
29