xref: /titanic_41/usr/src/cmd/ipf/lib/common/printmask.c (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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