Fix markup. Fix backslashes to surive roff.
[netbsd-mini2440.git] / dist / ipf / lib / printhostmask.c
blob01c53363074a9b143966e916475e9e49fce578e3
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2000-2005 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: printhostmask.c,v 1.8.4.1 2006/06/16 17:21:12 darrenr Exp
9 */
11 #include "ipf.h"
14 void printhostmask(v, addr, mask)
15 int v;
16 u_32_t *addr, *mask;
18 #ifdef USE_INET6
19 char ipbuf[64];
20 #else
21 struct in_addr ipa;
22 #endif
24 if (!*addr && !*mask)
25 printf("any");
26 else {
27 #ifdef USE_INET6
28 void *ptr = addr;
29 int af;
31 if (v == 4) {
32 ptr = addr;
33 af = AF_INET;
34 } else if (v == 6) {
35 ptr = addr;
36 af = AF_INET6;
37 } else
38 af = 0;
39 printf("%s", inet_ntop(af, ptr, ipbuf, sizeof(ipbuf)));
40 #else
41 ipa.s_addr = *addr;
42 printf("%s", inet_ntoa(ipa));
43 #endif
44 printmask(mask);