Files
Arquivotheca.SunOS-4.1.3/lib/libc/inet/inet_ntoa.c
seta75D 2e8a93c394 Init
2021-10-11 18:20:23 -03:00

24 lines
485 B
C

#if !defined(lint) && defined(SCCSIDS)
static char sccsid[] = "@(#)inet_ntoa.c 1.1 92/07/30 SMI"; /* from UCB 4.1 83/06/12 */
#endif
/*
* Convert network-format internet address
* to base 256 d.d.d.d representation.
*/
#include <sys/types.h>
#include <netinet/in.h>
char *
inet_ntoa(in)
struct in_addr in;
{
static char b[18];
register char *p;
p = (char *)&in;
#define UC(b) (((int)b)&0xff)
sprintf(b, "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3]));
return (b);
}