xref: /csrg-svn/usr.bin/uucp/vms/ntoa.c (revision 62413)
1*48675Sbostic /*	inet_ntoa.c	4.1	83/06/12	*/
2*48675Sbostic 
3*48675Sbostic /*
4*48675Sbostic  * Convert network-format internet address
5*48675Sbostic  * to base 256 d.d.d.d representation.
6*48675Sbostic  */
7*48675Sbostic #include <sys/types.h>
8*48675Sbostic #include <netinet/in.h>
9*48675Sbostic 
10*48675Sbostic char *
inet_ntoa(in)11*48675Sbostic inet_ntoa(in)
12*48675Sbostic 	struct in_addr in;
13*48675Sbostic {
14*48675Sbostic 	static char b[18];
15*48675Sbostic 	register char *p;
16*48675Sbostic 
17*48675Sbostic 	p = (char *)&in;
18*48675Sbostic #define	UC(b)	(((int)b)&0xff)
19*48675Sbostic 	sprintf(b, "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));
20*48675Sbostic 	return (b);
21*48675Sbostic }
22