Return to commands.c CVS log | Up to [local] / src / usr.bin / telnet |
version 1.83, 2016/03/16 15:41:11 | version 1.84, 2016/05/03 02:06:54 | ||
---|---|---|---|
|
|
||
gethostname(hbuf, sizeof hbuf); | gethostname(hbuf, sizeof hbuf); | ||
/* If this is not the full name, try to get it via DNS */ | |||
if (strchr(hbuf, '.') == 0) { | |||
struct hostent *he = gethostbyname(hbuf); | |||
if (he != 0) | |||
strncpy(hbuf, he->h_name, sizeof hbuf-1); | |||
hbuf[sizeof hbuf-1] = '\0'; | |||
} | |||
if (asprintf (&cp, "%s%s", hbuf, cp2) == -1) | if (asprintf (&cp, "%s%s", hbuf, cp2) == -1) | ||
err(1, "asprintf"); | err(1, "asprintf"); | ||