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