if (addr->family == AF_INET6) { memcpy(buf, (char*) addr->ai, 16); } else
if (addr->family == AF_INET) memcpy(buf, &((struct sockaddr_in *)addr->ai->ai_addr)->sin_addr, sizeof(struct in_addr)); else if (addr->family == AF_INET6) memcpy(buf, &((struct sockaddr_in6 *)addr->ai->ai_addr)->sin6_addr, sizeof(struct in6_addr)); else assert(FALSE); #else struct in_addr a;  assert(addr->family == AF_INET); a.s_addr = htonl(addr->address); memcpy(buf, (char*) &a.s_addr, 4);
void sk_addrcopy(SockAddr addr, char *buf){    assert(addr->family != AF_UNSPEC);#ifdef IPV6    if (addr->family == AF_INET6) {	memcpy(buf, (char*) addr->ai, 16);    } else#endif    if (addr->family == AF_INET) {	struct in_addr a;	a.s_addr = htonl(addr->address);	memcpy(buf, (char*) &a.s_addr, 4);    }}