xref: /titanic_50/usr/src/cmd/ipf/lib/common/printmask.c (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: printmask.c,v 1.5 2002/06/15 04:48:33 darrenr Exp $
7  */
8 
9 #include "ipf.h"
10 
11 
12 void	printmask(mask)
13 u_32_t	*mask;
14 {
15 	struct in_addr ipa;
16 	int ones;
17 
18 #ifdef  USE_INET6
19 	if (use_inet6)
20 		printf("/%d", count6bits(mask));
21 	else
22 #endif
23 	if ((ones = count4bits(*mask)) == -1) {
24 		ipa.s_addr = *mask;
25 		printf("/%s", inet_ntoa(ipa));
26 	} else
27 		printf("/%d", ones);
28 }
29