In telnetd.c, it does the following (slightly simplified):
/* Get local host name */
gethostname(host_name, sizeof(host_name));
hints.ai_family = PF_UNSPEC;
hints.ai_flags = AI_CANONNAME;
getaddrinfo(host_name, 0, &hints, &res);
strncpy(host_name, res->ai_canonname, sizeof(host_name)-1);The ai_canonname field gives the "official name of the host", according to "man getaddrinfo". HTH. -- Eric C. Cooper e c c @ c m u . e d u

