2 * numtohost - convert network number to host name.
6 #include "ntp_stdlib.h"
7 #include "lib_strbuf.h"
9 #define LOOPBACKNET 0x7f000000
10 #define LOOPBACKHOST 0x7f000001
11 #define LOOPBACKNETMASK 0xff000000
22 * This is really gross, but saves lots of hanging looking for
23 * hostnames for the radio clocks. Don't bother looking up
24 * addresses on the loopback network except for the loopback
27 if ((((ntohl(netnum) & LOOPBACKNETMASK) == LOOPBACKNET)
28 && (ntohl(netnum) != LOOPBACKHOST))
29 || ((hp = gethostbyaddr((char *)&netnum, sizeof netnum, AF_INET))
31 return numtoa(netnum);
35 bp[LIB_BUFLENGTH-1] = '\0';
36 (void) strncpy(bp, hp->h_name, LIB_BUFLENGTH-1);