/* mswindows.c -- Windows-specific support
- Copyright (C) 1995, 1996, 1997, 1998, 2004
- Free Software Foundation, Inc.
+ Copyright (C) 1996-2005 Free Software Foundation, Inc.
This file is part of GNU Wget.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+along with Wget; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
In addition, as a special exception, the Free Software Foundation
gives permission to link the code of its release of Wget with the
return buf;
}
}
+\f
+#ifdef ENABLE_IPV6
+/* An IPv6-only inet_ntop that prints with WSAAddressToString. (Wget
+ uses inet_ntoa for IPv4 addresses -- see print_address.) Prototype
+ complies with POSIX 1003.1-2004. */
+
+const char *
+inet_ntop (int af, const void *src, char *dst, socklen_t cnt)
+{
+ struct sockaddr_in6 sin6;
+ DWORD dstlen = cnt;
+
+ assert (af == AF_INET6);
+ xzero (sin6);
+ sin6.sin6_family = AF_INET6;
+ sin6.sin6_addr = *(struct in6_addr *) src;
+ if (WSAAddressToString ((struct sockaddr *) &sin6, sizeof (sin6),
+ NULL, dst, &dstlen) != 0)
+ {
+ errno = WSAGetLastError();
+ return NULL;
+ }
+ return (const char *) dst;
+}
+#endif