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