xref: /onnv-gate/usr/src/cmd/ipf/lib/common/printip.c (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * Copyright (C) 1993-2001 by Darren Reed.
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * See the IPFILTER.LICENCE file for details on licencing.
5*0Sstevel@tonic-gate  *
6*0Sstevel@tonic-gate  * $Id: printip.c,v 1.3 2002/07/13 12:10:27 darrenr Exp $
7*0Sstevel@tonic-gate  */
8*0Sstevel@tonic-gate 
9*0Sstevel@tonic-gate #include "ipf.h"
10*0Sstevel@tonic-gate 
11*0Sstevel@tonic-gate 
printip(addr)12*0Sstevel@tonic-gate void	printip(addr)
13*0Sstevel@tonic-gate u_32_t	*addr;
14*0Sstevel@tonic-gate {
15*0Sstevel@tonic-gate 	struct in_addr ipa;
16*0Sstevel@tonic-gate 
17*0Sstevel@tonic-gate 	ipa.s_addr = *addr;
18*0Sstevel@tonic-gate 	if (ntohl(ipa.s_addr) < 256)
19*0Sstevel@tonic-gate 		printf("%lu", (u_long)ntohl(ipa.s_addr));
20*0Sstevel@tonic-gate 	else
21*0Sstevel@tonic-gate 		printf("%s", inet_ntoa(ipa));
22*0Sstevel@tonic-gate }
23