diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1998-06-11 09:03:02 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1998-06-11 09:03:02 +0000 |
| commit | 14b93edab315672d87e6fe82aaff8e7ee7378e0b (patch) | |
| tree | b521683c722481012df1712a7d17ca84afecfae7 /lib/libc/net/inet_ntoa.c | |
| parent | a28ce30ec5add9bffb06bd8e1c5cfdf45637e682 (diff) | |
Notes
Diffstat (limited to 'lib/libc/net/inet_ntoa.c')
| -rw-r--r-- | lib/libc/net/inet_ntoa.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/libc/net/inet_ntoa.c b/lib/libc/net/inet_ntoa.c index a37b1dbeefd1..4fdceeed4873 100644 --- a/lib/libc/net/inet_ntoa.c +++ b/lib/libc/net/inet_ntoa.c @@ -35,25 +35,23 @@ static char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -/* - * Convert network-format internet address - * to base 256 d.d.d.d representation. - */ #include <sys/types.h> +#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> +/* + * Convert network-format internet address + * to base 256 d.d.d.d representation. + */ char * inet_ntoa(in) struct in_addr in; { - static char b[18]; - register char *p; + static char ret[18]; - p = (char *)∈ -#define UC(b) (((int)b)&0xff) - (void)snprintf(b, sizeof(b), - "%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); - return (b); + strcpy(ret, "[inet_ntoa error]"); + (void) inet_ntop(AF_INET, &in, ret, sizeof ret); + return (ret); } |
