]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/ipfilter/lib/printmask.c
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / contrib / ipfilter / lib / printmask.c
1 /*      $FreeBSD$       */
2
3 /*
4  * Copyright (C) 2000-2005 by Darren Reed.
5  *
6  * See the IPFILTER.LICENCE file for details on licencing.
7  *
8  * $Id: printmask.c,v 1.5.4.1 2006/06/16 17:21:13 darrenr Exp $
9  */
10
11 #include "ipf.h"
12
13
14 void    printmask(mask)
15 u_32_t  *mask;
16 {
17         struct in_addr ipa;
18         int ones;
19
20 #ifdef  USE_INET6
21         if (use_inet6)
22                 printf("/%d", count6bits(mask));
23         else
24 #endif
25         if ((ones = count4bits(*mask)) == -1) {
26                 ipa.s_addr = *mask;
27                 printf("/%s", inet_ntoa(ipa));
28         } else
29                 printf("/%d", ones);
30 }