121371Sdist /* 221371Sdist * Copyright (c) 1983 Regents of the University of California. 333676Sbostic * All rights reserved. 433676Sbostic * 542626Sbostic * %sccs.include.redist.c% 621371Sdist */ 713031Sroot 826615Sdonn #if defined(LIBC_SCCS) && !defined(lint) 9*46604Sbostic static char sccsid[] = "@(#)inet_ntoa.c 5.6 (Berkeley) 02/24/91"; 1033676Sbostic #endif /* LIBC_SCCS and not lint */ 1121371Sdist 1213031Sroot /* 1313031Sroot * Convert network-format internet address 1413031Sroot * to base 256 d.d.d.d representation. 1513031Sroot */ 1613031Sroot #include <sys/types.h> 1713031Sroot #include <netinet/in.h> 18*46604Sbostic #include <arpa/inet.h> 19*46604Sbostic #include <stdio.h> 2013031Sroot 2113031Sroot char * 2213031Sroot inet_ntoa(in) 2313031Sroot struct in_addr in; 2413031Sroot { 2513031Sroot static char b[18]; 2613031Sroot register char *p; 2713031Sroot 2813031Sroot p = (char *)∈ 2913031Sroot #define UC(b) (((int)b)&0xff) 30*46604Sbostic (void)snprintf(b, sizeof(b), 31*46604Sbostic "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); 3213031Sroot return (b); 3313031Sroot } 34