From ed0fe1449ced9e64280bf99b8847651bef3822f7 Mon Sep 17 00:00:00 2001 From: Alfred Perlstein Date: Sat, 25 Nov 2000 03:14:31 +0000 Subject: [PATCH] add threadsafe version of inet_ntoa (inet_ntoa_r takes a buffer to fill) this is used by some debugging functions --- sys/libkern/inet_ntoa.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/libkern/inet_ntoa.c b/sys/libkern/inet_ntoa.c index 558188c5dcc..25cfff1e954 100644 --- a/sys/libkern/inet_ntoa.c +++ b/sys/libkern/inet_ntoa.c @@ -48,3 +48,17 @@ inet_ntoa(struct in_addr ina) return buf; } +char * +inet_ntoa_r(struct in_addr ina, char *buf) +{ + unsigned char *ucp = (unsigned char *)&ina; + + sprintf(buf, "%d.%d.%d.%d", + ucp[0] & 0xff, + ucp[1] & 0xff, + ucp[2] & 0xff, + ucp[3] & 0xff); + return buf; +} + +