1 /* 2 * Copyright (c) 1983 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 static char sccsid[] = "@(#)inet_ntoa.c 5.5 (Berkeley) 06/01/90"; 10 #endif /* LIBC_SCCS and not lint */ 11 12 /* 13 * Convert network-format internet address 14 * to base 256 d.d.d.d representation. 15 */ 16 #include <sys/types.h> 17 #include <netinet/in.h> 18 19 char * 20 inet_ntoa(in) 21 struct in_addr in; 22 { 23 static char b[18]; 24 register char *p; 25 26 p = (char *)∈ 27 #define UC(b) (((int)b)&0xff) 28 sprintf(b, "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); 29 return (b); 30 } 31