{
static char buffer[BUFSIZ] = "";
struct addrinfo hints, *res;
{
static char buffer[BUFSIZ] = "";
struct addrinfo hints, *res;
/* check if we have cached the local name */
if (buffer[0])
return buffer;
memset(buffer, 0, sizeof(buffer));
/* check if we have cached the local name */
if (buffer[0])
return buffer;
memset(buffer, 0, sizeof(buffer));
/* first get our local name */
gethostname(buffer, sizeof(buffer) - 1);
/* first get our local name */
gethostname(buffer, sizeof(buffer) - 1);
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = PF_UNSPEC;