Cannot refer to usa->sin6.sin6_addr if !defined(USE_IPV6).
Also, I think determining whether to fill in buf with sin_addr vs sin6_addr could be done for all platforms, with the sin6_addr code being protected by #if defined(USE_IPV6).