add threadsafe version of inet_ntoa (inet_ntoa_r takes a buffer to fill)

this is used by some debugging functions
This commit is contained in:
Alfred Perlstein 2000-11-25 03:14:31 +00:00
parent d28632c097
commit ed0fe1449c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69134

View File

@ -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;
}