summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/inet_ntoa.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-06-11 09:03:02 +0000
committerpeter <peter@FreeBSD.org>1998-06-11 09:03:02 +0000
commit9492d9f3a276bb1ce288f7f1242f55ba381fb5d8 (patch)
tree1fedca6b8adcc385c524308ec3d4040f66de30c6 /lib/libc/net/inet_ntoa.c
parenta17a83618dae26baf5445f202b4ed0ce247b3f86 (diff)
downloadFreeBSD-src-9492d9f3a276bb1ce288f7f1242f55ba381fb5d8.zip
FreeBSD-src-9492d9f3a276bb1ce288f7f1242f55ba381fb5d8.tar.gz
Update the resolver parts to bind-8.1.2 level. I have not touched the
getXXXXbyYYYY() interfaces yet. Obtained from: diff relative to bind-8.1.2 sources
Diffstat (limited to 'lib/libc/net/inet_ntoa.c')
-rw-r--r--lib/libc/net/inet_ntoa.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/libc/net/inet_ntoa.c b/lib/libc/net/inet_ntoa.c
index a37b1db..4fdceee 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 *)&in;
-#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);
}
OpenPOWER on IntegriCloud