(39 . 7)(39 . 12)
5 struct in_addr addr;
6 addr.s_addr = htonl(ip);
7 char *txt = inet_ntoa(addr);
8 strncpy(buf, txt, buf_size);
9 /* Given IP might be shorter than buf_size so don't copy blindly. */
10 int len = strlen(txt);
11 /* ONTH don't ever copy more than buf_size either */
12 if (len > buf_size)
13 len = buf_size;
14 strncpy(buf, txt, len);
15 }
16 /* Should be replaced with native routine */
17