121371Sdist /* 221371Sdist * Copyright (c) 1983 Regents of the University of California. 3*33676Sbostic * All rights reserved. 4*33676Sbostic * 5*33676Sbostic * Redistribution and use in source and binary forms are permitted 6*33676Sbostic * provided that this notice is preserved and that due credit is given 7*33676Sbostic * to the University of California at Berkeley. The name of the University 8*33676Sbostic * may not be used to endorse or promote products derived from this 9*33676Sbostic * software without specific prior written permission. This software 10*33676Sbostic * is provided ``as is'' without express or implied warranty. 1121371Sdist */ 1213031Sroot 1326615Sdonn #if defined(LIBC_SCCS) && !defined(lint) 14*33676Sbostic static char sccsid[] = "@(#)inet_ntoa.c 5.3 (Berkeley) 03/07/88"; 15*33676Sbostic #endif /* LIBC_SCCS and not lint */ 1621371Sdist 1713031Sroot /* 1813031Sroot * Convert network-format internet address 1913031Sroot * to base 256 d.d.d.d representation. 2013031Sroot */ 2113031Sroot #include <sys/types.h> 2213031Sroot #include <netinet/in.h> 2313031Sroot 2413031Sroot char * 2513031Sroot inet_ntoa(in) 2613031Sroot struct in_addr in; 2713031Sroot { 2813031Sroot static char b[18]; 2913031Sroot register char *p; 3013031Sroot 3113031Sroot p = (char *)∈ 3213031Sroot #define UC(b) (((int)b)&0xff) 3313031Sroot sprintf(b, "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); 3413031Sroot return (b); 3513031Sroot } 36