printmask.c revision 145519
1145519Sdarrenr/* $FreeBSD: head/contrib/ipfilter/lib/printmask.c 145519 2005-04-25 18:20:15Z darrenr $ */ 2145510Sdarrenr 3145510Sdarrenr/* 4145510Sdarrenr * Copyright (C) 1993-2001 by Darren Reed. 5145510Sdarrenr * 6145510Sdarrenr * See the IPFILTER.LICENCE file for details on licencing. 7145510Sdarrenr * 8145510Sdarrenr * Id: printmask.c,v 1.5 2002/06/15 04:48:33 darrenr Exp 9145510Sdarrenr */ 10145510Sdarrenr 11145510Sdarrenr#include "ipf.h" 12145510Sdarrenr 13145510Sdarrenr 14145510Sdarrenrvoid printmask(mask) 15145510Sdarrenru_32_t *mask; 16145510Sdarrenr{ 17145510Sdarrenr struct in_addr ipa; 18145510Sdarrenr int ones; 19145510Sdarrenr 20145510Sdarrenr#ifdef USE_INET6 21145510Sdarrenr if (use_inet6) 22145510Sdarrenr printf("/%d", count6bits(mask)); 23145510Sdarrenr else 24145510Sdarrenr#endif 25145510Sdarrenr if ((ones = count4bits(*mask)) == -1) { 26145510Sdarrenr ipa.s_addr = *mask; 27145510Sdarrenr printf("/%s", inet_ntoa(ipa)); 28145510Sdarrenr } else 29145510Sdarrenr printf("/%d", ones); 30145510Sdarrenr} 31