]> sjero.net Git - wget/blobdiff - src/mswindows.c
[svn] Update FSF's address and copyright years.
[wget] / src / mswindows.c
index e61e9b8df9a0dd9e12ffa432176a79e5869b69b7..245114fe5280d70b048947f613438fbd18ceb08e 100644 (file)
@@ -1,6 +1,5 @@
 /* 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.
 
@@ -15,8 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 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
@@ -848,3 +847,28 @@ windows_strerror (int err)
       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