} else {
else { ret->error = NULL;  #ifdef IPV6  if (ret->ai) { typedef int (CALLBACK* FGETNAMEINFO) (const struct sockaddr FAR *sa, socklen_t salen, char FAR * host, size_t hostlen, char FAR * serv, size_t servlen, int flags); FGETNAMEINFO fGetNameInfo = NULL;    if (ret->family == AF_INET) memcpy(&a, (char *)&((SOCKADDR_IN *)ret->ai->ai_addr)->sin_addr, sizeof(a));   if ((dllWSHIP6) && (fGetNameInfo = (FGETNAMEINFO)GetProcAddress(dllWSHIP6, "getnameinfo"))) { if (fGetNameInfo((struct sockaddr *)ret->ai->ai_addr, ret->family == AF_INET ? sizeof(SOCKADDR_IN) : sizeof(SOCKADDR_IN6), ret->realhost, sizeof(ret->realhost), NULL, 0, 0) != 0) { strncpy(ret->realhost, host, sizeof(ret->realhost)); } } }  else { #endif memcpy(&a, h->h_addr, sizeof(a));  strncpy(ret->realhost, h->h_name, sizeof(ret->realhost)); #ifdef IPV6 } #endif } #ifdef IPV6 FreeLibrary(dllWSHIP6); #endif } else {
SockAddr sk_namelookup(char *host, char **canonicalname) {    SockAddr ret = smalloc(sizeof(struct SockAddr_tag));    unsigned long a;    struct hostent *h;    ret->error = NULL;    if ( (a = inet_addr(host)) == (unsigned long) INADDR_NONE) {	if ( (h = gethostbyname(host)) == NULL) {	    DWORD err = WSAGetLastError();	    ret->error = winsock_error_string(err);	} else {	    memcpy (&a, h->h_addr, sizeof(a));	    *canonicalname = h->h_name;	}    } else {	*canonicalname = host;    }    ret->address = ntohl(a);    return ret;}