--- wget-1.8.2.orig/debian/README.build
+++ wget-1.8.2/debian/README.build
@@ -0,0 +1,24 @@
+correct location for wgetrc in manpage
+
+# 152990
+----- begin patch -----
+diff -urp wget-1.8.1/src/netrc.c wget-fixed/src/netrc.c
+--- wget-1.8.1/src/netrc.c      Fri Nov 30 04:33:22 2001
++++ wget-fixed/src/netrc.c      Sun Feb 17 18:12:20 2002
+@@ -313,9 +313,12 @@ parse_netrc (const char *path)
+            p ++;
+          }
+
+-         /* if field was quoted, squash the trailing quotation mark */
+-         if (quote)
++         /* if field was quoted, squash the trailing quotation mark
++            and reset quote flag */
++         if (quote) {
+            shift_left(p);
++           quote = 0;
++         }
+
+          /* Null-terminate the token, if it isn't already.  */
+          if (*p)
+----- end patch -----
+
--- wget-1.8.2.orig/debian/changelog
+++ wget-1.8.2/debian/changelog
@@ -0,0 +1,464 @@
+wget (1.8.2-12) unstable; urgency=low
+
+  * converted changelog, control and copyrigh to utf-8
+  * added patch from Philip Stadermann to fix segfault when
+    downloading from ftp with this command:
+    wget --passive-ftp --limit-rate 32k -r -nc -l 50 \
+    -X */binary-alpha,*/binary-powerpc,*/source,*/incoming \
+    -R alpha.deb,powerpc.deb,diff.gz,.dsc,.orig.tar.gz \
+    ftp://ftp.gwdg.de/pub/x11/kde/stable/3.1.4/Debian
+    thx Philip
+
+ -- Noèl Köthe <noel@debian.org>  Tue, 14 Oct 2003 22:49:00 +0200
+
+wget (1.8.2-11) unstable; urgency=low
+
+  * added --tries default to documentation
+    (closes: Bug#181150)
+  * changed one line description of wget from "GNU Wget Manual" to
+    "commandline tool for retrieving files using HTTP, HTTPS and FTP"
+    (closes: Bug#187455)
+  * updated Standards-Version
+
+ -- Noel Koethe <noel@debian.org>  Mon, 25 Aug 2003 22:50:00 +0200
+
+wget (1.8.2-10) unstable; urgency=low
+
+  * upload for rebuild on m68k
+
+ -- Noel Koethe <noel@debian.org>  Mon, 17 Mar 2003 23:22:00 +0100
+
+wget (1.8.2-9) unstable; urgency=low
+
+  * rebuild against libssl0.9.7
+
+ -- Noel Koethe <noel@debian.org>  Thu, 30 Jan 2003 12:02:00 +0100
+
+wget (1.8.2-8) unstable; urgency=high
+
+  * fixed Directory Traversal Vulnerabilities security
+    problem described in
+    http://archives.neohapsis.com/archives/vulnwatch/2002-q4/0102.html
+    (closes: Bug#172603)
+    woody is handled by the security team and will follow soon.
+
+ -- Noel Koethe <noel@debian.org>  Wed, 11 Dec 2002 12:21:00 +0100
+
+wget (1.8.2-7) unstable; urgency=low
+
+  * updated config.guess and config.sub for mips/mipsel
+    (closes: Bug#172457)
+
+ -- Noel Koethe <noel@debian.org>  Tue, 10 Dec 2002 13:02:00 +0100
+
+wget (1.8.2-6) unstable; urgency=high
+
+  * applied patch from Baruch Even <baruch@d.o> to fix
+    seg fault with special url line reported by
+    Stefano Zacchiroli <zack@d.o>. Thanks!!
+  * applied ipv6 patch from Fabio Massimo Di Nitto
+    (closes: Bug#162046)
+
+ -- Noel Koethe <noel@debian.org>  Tue,  3 Dec 2002 10:38:00 +0100
+
+wget (1.8.2-5) unstable; urgency=low
+
+  * removed debian/conffile because /etc/wgetrc ist included
+    by debhelper
+    (closes: Bug#155789)
+  * added largefile support patch from Eduard Bloch
+    (closes: Bug#137989)
+
+ -- Noel Koethe <noel@debian.org>  Sat, 24 Aug 2002 23:29:00 +0200
+
+wget (1.8.2-4) unstable; urgency=high
+
+  * corrected .netrc parsing bug
+    (closes: Bug#152990)
+
+ -- Noel Koethe <noel@debian.org>  Mon, 15 Jul 2002 08:30:00 +0200
+
+wget (1.8.2-3) unstable; urgency=low
+
+  * corrected wgetrc path in /etc/wgetrc
+    (closes: Bug#148575)
+
+ -- Noel Koethe <noel@debian.org>  Thu, 30 May 2002 21:00:00 +0200
+
+wget (1.8.2-2) unstable; urgency=low
+
+  * forgot to add ssl build-deps;
+    add libssl-dev and texi2html to build-depends
+    (closes: Bug#148481)
+
+ -- Noel Koethe <noel@debian.org>  Wed, 26 May 2002 15:54:00 +0200
+
+wget (1.8.2-1) unstable; urgency=low
+
+  * new upstream 1.8.2 from 2002-05-26
+  * added OpenSSL exception to debian/copyright
+  * wget has now an OpenSSL exception and crypto into main
+    is allowed so this version is build with https: support
+  * upstream fixed problem with segfault when using wrong
+    URLs
+    (closes: Bug#139059)
+    (closes: Bug#140076)
+  * upstream documented --limit-rate
+    (closes: Bug#147009)
+  * passive_ftp = on in /etc/wgetrc
+    (closes: Bug#105278)
+  * --reject option in the dosumentation has now a link to
+    "Types of Files" where pattern is described.
+    (closes: Bug#135498)
+  * added upstream patch to correct wrong return
+    (closes: Bug#117774)
+  * since 1.8x you can use .netrc to store machine dependant
+    accounts
+    (closes: Bug#114366)
+
+ -- Noel Koethe <noel@debian.org>  Wed, 26 May 2002 07:29:00 +0200
+
+wget (1.8.1-6) unstable; urgency=medium
+
+  * upstream provided a patch for the documentation which
+    warns of passwords in process list
+    (closes: Bug#106361)
+  * addedpatch from Junichi Uekawa, which gives out a warning
+    when using -np, to have no broken option potato -> woody
+    (closes: Bug#140564)
+
+ -- Noel Koethe <noel@debian.org>  Sun, 14 Apr 2002 16:06:00 +0200
+
+wget (1.8.1-5) unstable; urgency=low
+
+  * corrected some typos in description
+    (closes: Bug#137512)
+
+ -- Noel Koethe <noel@debian.org>  Fri, 29 Mar 2002 13:49:00 +0100
+
+wget (1.8.1-4) unstable; urgency=low
+
+  * removed texi2html (not needed anymore)
+    (closes: Bug#135497)
+  * closing fixed problem in v 1.8.1
+    (closes: Bug#61433)
+
+ -- Noel Koethe <noel@debian.org>  Tue, 26 Feb 2002 13:29:00 +0100
+
+wget (1.8.1-3) unstable; urgency=low
+
+  * added texinfo to Build-Deps
+    (closes: Bug#134830)
+  * fixed problem with wget info page
+    (closes: Bug#134855)
+
+ -- Noel Koethe <noel@debian.org>  Wed, 20 Feb 2002 10:35:00 +0100
+
+wget (1.8.1-2) unstable; urgency=medium
+
+  * corrected parsing of .netrc
+    (closes: Bug#134463)
+  * will close the fixed bugs of wget tomorrow
+  * if crypto will be allowed in main,I will remove wget-ssl
+    and compile wget with ssl support
+  * corrected references to global config file in manpage
+    (closes: Bug#133701)
+  * added an upstream patch to make DO_REALLOC_FROM_ALLOCA
+    in wget.h work
+  * added an upstream patch to correct quotations of : and @
+    in username and password
+    (closes: Bug#88314)
+  * added an upstream patch to correct handling of
+    <meta http-equiv=Refresh> (without "a content")
+
+ -- Noel Koethe <noel@debian.org>  Tue, 19 Feb 2002 10:12:00 +0100
+
+wget (1.8.1-1) unstable; urgency=low
+
+  * took the package
+
+ -- Noel Koethe <noel@debian.org>  Mon, 18 Feb 2002 09:40:00 +0100
+
+wget (1.8.1-0.2) unstable; urgency=low
+
+  * corrected dependencies. Sorry.
+
+ -- Noel Koethe <noel@debian.org>  Fri,  8 Feb 2002 00:02:00 +0100
+
+wget (1.8.1-0.1) unstable; urgency=low 
+
+  * NMU 
+    with help from Guillaume Morin <gemorin@debian.org>
+  * new upstream version
+    (closes: Bug#123878)
+  * updated description with description from homepage
+  * closing Bugs checked by Guillaume Morin <gemorin@debian.org>:
+    Thanks to him for this work.
+    (closes: Bug#43857)
+    (closes: Bug#48727)
+    (closes: Bug#58899)
+    (closes: Bug#117898)
+    (closes: Bug#117970)
+    (closes: Bug#119838)
+    (closes: Bug#130281)
+
+ -- Noel Koethe <noel@debian.org>  Fri,  8 Feb 2002 16:23:00 +0100
+
+wget (1.7-3) unstable; urgency=low
+
+  * It now exits with non-zero status if an unkwnown option was given
+    (closes:Bug#108334).
+  * Added updated Japanese translation contributed by
+    Hiroyuki YAMAMORI <h-yamamo@db3.so-net.ne.jp> (closes:Bug#116197).
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sun, 21 Oct 2001 18:02:53 -0300
+
+wget (1.7-2.1) unstable; urgency=low
+
+  * Non-maintainer upload
+  * Incorporate drow's patch.  Uses __va_copy() to prevent segfaults on
+    powerpc due to by-reference passing of va_list's.
+    (closes:Bug#109348)
+
+ -- Michael Weber <michaelw@debian.org>  Tue, 25 Sep 2001 05:40:17 -0400
+
+wget (1.7-2) unstable; urgency=low
+
+  * It now calls daemon(3) when working in the background (-b). This makes
+    wget close stdin/stdout/stderr and puts the background process in a new
+    session. This made ssh hang when one started `wget -b' and logged out.
+  * Minor fix to Spanish translation.
+  * Made it print numbers using the proper locale symbols for the decimal
+    separator and thousands grouping.
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sat, 11 Aug 2001 15:22:16 -0300
+
+wget (1.7-1) unstable; urgency=low
+
+  * New upstream release (closes:Bug#102424,Bug#100154).
+  * The manpage is now automatically generated from the texinfo source.
+    I've readded the EXAMPLES section to it. Configuration file options
+    and conceptual descriptions are only in the info docs for now (so
+    this closes:Bug#97484, which was about an error in the documented startup
+    options) and...
+    * In the new manpage -U is documented (closes:Bug#92663).
+    * Passive_ftp option not in manpage, but there are no more config
+      options there! (closes:Bug#97982).
+  * It now correctly prints accented characters (closes:Bug#97582).
+  * Added build-depends for perl, since wget now uses pod2man.
+  * Merged the new upstream Spanish translation with my old one.
+  * Fixed a message in http.c so it can be translated properly.
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Tue,  7 Aug 2001 10:01:29 -0300
+
+wget (1.6-2) unstable; urgency=low
+
+  * Really updated Spanish messages.
+  * Fixed SIGSEGV when doing: wget -nv -r --passive-ftp '#asda:asdasd'
+    (closes:Bug#81536).
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Tue, 27 Feb 2001 23:42:54 -0300
+
+wget (1.6-1) unstable; urgency=low
+
+  * New upstream release (closes:Bug#81130).
+    * This version seems to properly converts HTML entities
+      (closes:Bug#65790).
+    * Now supports non-compliant redirections with a relative URL in their
+      Location: headers (closes:Bug#62431,Bug#64449).
+    * It now longer converts // in URLs to / outside of the path area of the
+      URL (closes:Bug#61386).
+  * Updated Spanish translation.
+  * Updated manpage to 1.6 version.
+  * Merged previous Debian patches to this new release.
+  * The sort version of the --cache option was missing from the getopt
+    invocation, now -C works (closes:Bug#67106).
+  * Added `setlocale (LC_CTYPE, "")' to enable the display of non-ASCII
+    characters in localized messages.
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sun, 25 Feb 2001 23:56:47 -0300
+
+wget (1.5.3-7) unstable; urgency=low
+
+  * Fixes to German translation contributed by
+    Jonathan Picht <jonathan.picht@web.de> (closes:Bug#80841).
+  * Added build-time dependency on gettext.
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sun, 31 Dec 2000 17:25:05 -0300
+
+wget (1.5.3-6) unstable; urgency=low
+
+  * Updated Spanish messages with contribution from
+    Carlos Horny <angus@quovadis.com.ar>.
+  * Added groff as a build-dependency (closes:Bug#72471).
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sun,  1 Oct 2000 19:03:16 -0300
+
+wget (1.5.3-5) unstable; urgency=low
+
+  * Changed fix for not including for the upstream version, just to keep the
+    code similar.
+  * Selected patches from the upstream CVS 'eternal beta' version.
+    * Fixed small memory leak.
+    * Why does it free memory allocated with alloca()? Fixed.
+    * Follow "<link href=" and "<script src=" (closes:Bug#69162,Bug#37273).
+    * Follows correctly links with two '#' markers. The fix was completelly
+      broken upstream.
+    * Function store_hostaddress in host.c wasn't 64 bit clean. Better
+      fix than upstream's: Use the proper 32 bit type for the IPv4 address
+      instead of using whatever the architecture has as an `unsigned long'
+      and adding "sizeof (unsigned long) - 4" to the pointer (eew!).
+      Replace obsolete function inet_addr with inet_aton.
+  * Started Spanish translation. It's incomplete, but it will improve.
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sun, 24 Sep 2000 01:22:00 -0300
+
+wget (1.5.3-4) unstable; urgency=low
+
+  * Do not add :80 to Host header to cope with broken HTTP servers
+    (closes:Bug#39346).
+  * Added Build-Depends header.
+  * Uses standard texi2html from the Debian package.
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Mon, 28 Aug 2000 00:40:04 -0300
+
+wget (1.5.3-3) unstable; urgency=low
+
+  * Added --base option to info documentation with text taken from the
+    manpage. Uhm.. someone needs to keep this info file upto-date with the
+    manpage... perhaps I should remove the info docs.. =) =)
+    (closes: Bug#39808).
+  * Added Janapese messages from ja-tans package (closes:Bug#43847).
+  * Added `--cut-dirs' to manpage (closes:Bug#42129).
+  * Moved docs under /usr/share.
+  * Updated `Standards-Version' to 3.0.1.
+  * Added call to dh_clean, it was generating repeating maintainer scripts
+    without that! =).
+  * Updated copyright file.
+  * Removed redundant menu entry (closes:Bug#42510).
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sun, 10 Oct 1999 06:04:32 -0300
+
+wget (1.5.3-2) unstable; urgency=low
+
+  * Updated maintainer address.
+  * Switched to debhelper.
+  * Added doc-base support (closes: #31165).
+  * Added define needed to get strptime prototype.
+  * Added the AUTHORS file to /usr/doc/wget.
+
+ -- Nicolás Lichtmaier <nick@debian.org>  Sun, 20 Jun 1999 18:33:01 -0300
+
+wget (1.5.3-1.1) frozen unstable; urgency=high
+
+  * fix bug #33624 (of severity 'Important' for security reasons).
+
+ -- Vincent Renardias <vincent@waw.com>  Sat, 20 Feb 1999 22:49:00 +0100
+
+wget (1.5.3-1) unstable; urgency=low
+
+  * Uses src/ChangeLog as upstream changelog.
+  * Added `SHELL=/bin/bash' to debian/rules.
+  * Changed references to /usr/local/etc/wgetrc to /etc/wgetrc.
+  * New upstream release, fixes bug #26989.
+
+ -- Nicolás Lichtmaier <nick@feedback.net.ar>  Sat, 26 Sep 1998 08:06:22 -0300
+
+wget (1.5.1-1) unstable; urgency=low
+
+  * Stripped .note and .comment sections from binary.
+  * Added a short disclaimer to manpage. There will probably be more
+    changes when I have the time.
+  * Really changed maintainer now.
+  * New upstream release.
+
+ -- Nicolás Lichtmaier <nick@feedback.net.ar>  Sun, 17 May 1998 01:18:18 -0300
+
+wget (1.5.0-2) unstable; urgency=low
+
+  * Updated manpage.
+  * Improved an error message.
+
+ -- Nicolás Lichtmaier <nick@feedback.net.ar>  Sun, 26 Apr 1998 11:04:42 -0300
+
+wget (1.5.0-1) unstable; urgency=low
+
+  * Readded manpage (removed upstream, needs updating).
+  * Moved html to html subdir and updated menu file.
+  * Updated copyright file.
+  * Taken over by me =).
+  * New upstream release.
+
+ -- Nicolás Lichtmaier <nick@feedback.net.ar>  Mon, 20 Apr 1998 23:19:00 -0300
+
+wget (1.4.5-0.1) unstable; urgency=low
+
+  * Register html documentation with dwww.
+  * Fixed location of config file (bugs #13722, #11359).
+  * Fixed `*.info' installation.
+  * Removed useless README.debian.
+  * Removed generated html files from diff.
+  * Built with libc6.
+  * Keep files' date.
+  * Added AUTHOR information to copyright file.
+  * Added MAILING-LIST, TODO and ChangeLog (as changelog.gz) to installed
+    documentation.
+  * Many packaging fixes.
+  * New upstream release (non-maintainer upload), fixes bugs #9865,#10421.
+
+ -- Nicolás Lichtmaier <nick@feedback.net.ar>  Sat, 18 Oct 1997 21:23:12 -0300
+
+wget (1.4.4-6) frozen unstable; urgency=low
+
+  * Closes bug #8370: applied small patch by the upstream author 
+    * Hrvoje Niksic <hniksic@srce.hr>. 
+    * Patch sent to me by Barak Pearlmutter <bap@cs.unm.edu>.
+
+ -- J. Ramos Goncalves <ramos@debian.org>  Fri, 28 Mar 1997 14:38:42 +0000
+
+wget (1.4.4-5) frozen unstable; urgency=low
+
+  * Closes bug #8335: wget man page was referring to /usr/local/lib/wgetrc 
+    *  instead of /etc/wgetrc (corrected also for the html documentation).
+
+ -- J. Ramos Goncalves <ramos@debian.org>  Wed, 26 Mar 1997 15:15:12 +0000
+
+wget (1.4.4-4) unstable; urgency=low
+
+  * Closed bug #7977: corrected md5sum for files README, README.debian,
+    *  changelog.Debian, and buildinfo.Debian.
+
+ -- J. Ramos Goncalves <ramos@debian.org>  Mon, 10 Mar 1997 10:32:10 +0000
+
+wget (1.4.4-3) unstable; urgency=low
+
+  * Closed bug #7868: size of the *.html document is not against the
+    *  policy.
+  * Bug #7865 fixed: withdrawn unnecessary message in postint.
+
+ -- J. Ramos Goncalves <ramos@debian.org>  Thu, 06 Mar 1997 23:12:20 +0000
+
+wget (1.4.4-2) unstable; urgency=low
+
+  * Bug #7768 fixed: wget.info gets installed now.
+
+ -- J. Ramos Goncalves <ramos@debian.org>  Sun, 02 Mar 1997 23:38:25 +0000
+
+wget (1.4.4-1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- J. Ramos Goncalves <ramos@debian.org>  Tue, 25 Feb 1997 01:02:00 +0000
+
+wget (1.4.3-1) unstable; urgency=low
+
+  * New upstream version.
+  * New maintainer.
+
+ -- J. Ramos Goncalves <ramos@debian.org>  Thu, 13 Feb 1997 23:15:18 +0000
+
+wget (1.4.0-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Christian Schwarz <schwarz@monet.m.isar.de>  Mon, 18 Nov 1996 00:59:57 +0100
--- wget-1.8.2.orig/debian/control
+++ wget-1.8.2/debian/control
@@ -0,0 +1,32 @@
+Source: wget
+Section: web
+Priority: optional
+Maintainer: Noel Koethe <noel@debian.org>
+Build-Depends: debhelper (>> 3.0.0), groff, gettext, texinfo, texi2html, libssl-dev
+Standards-Version: 3.6.0
+
+Package: wget
+Architecture: any
+Depends: ${shlibs:Depends}
+Conflicts: wget-ssl
+Description: retrieves files from the web
+ Wget is a network utility to retrieve files from the Web
+ using http and ftp, the two most widely used Internet
+ protocols. It works non-interactively, so it will work in
+ the background, after having logged off. The program supports
+ recursive retrieval of web-authoring pages as well as ftp
+ sites -- you can use wget to make mirrors of archives and
+ home pages or to travel the Web like a WWW robot.
+ .
+ Wget works particularly well with slow or unstable connections
+ by continuing to retrieve a document until the document is fully
+ downloaded. Re-getting files from where it left off works on
+ servers (both http and ftp) that support it. Both http and ftp
+ retrievals can be time stamped, so wget can see if the remote
+ file has changed since the last retrieval and automatically
+ retrieve the new version if it has.
+ .
+ Wget supports proxy servers; this can lighten the network load,
+ speed up retrieval, and provide access behind firewalls.
+ .
+ http://www.gnu.org/software/wget/
--- wget-1.8.2.orig/debian/copyright
+++ wget-1.8.2/debian/copyright
@@ -0,0 +1,26 @@
+This package was debianized by
+Christian Schwarz <schwarz@monet.m.isar.de> on Mon, 18 Nov 1996 00:59:57 +0100
+J. Ramos Goncalves <ramos@debian.org> on Thu, 13 Feb 1997 23:15:18 +0000
+Nicolás Lichtmaier <nick@debian.org> on Sat, 18 Oct 1997 21:23:12 -0300
+Noèl Köthe <noel@debian.org> on Mon, 18 Feb 2002 09:53:00 +0100
+
+It was downloaded from ftp://ftp.gnu.org/gnu/wget/
+	Homepage: http://www.gnu.org/directory/wget.html
+		  http://www.gnu.org/software/wget/wget.html
+
+Upstream Author: Hrvoje Niksic <hniksic@arsdigita.com>
+
+Copyright:
+
+Released under the terms of the GPL; see 
+/usr/share/common-licenses/GPL.
+
+"In addition, as a special exception, the Free Software Foundation
+gives permission to link the code of its release of Wget with the
+OpenSSL project's "OpenSSL" library (or with modified versions of it
+that use the same license as the "OpenSSL" library), and distribute
+the linked executables.  You must obey the GNU General Public License
+in all respects for all of the code used other than "OpenSSL".  If you
+modify this file, you may extend this exception to your version of the
+file, but you are not obligated to do so.  If you do not wish to do
+so, delete this exception statement from your version."
--- wget-1.8.2.orig/debian/dirs
+++ wget-1.8.2/debian/dirs
@@ -0,0 +1,6 @@
+etc
+usr/bin
+usr/share/doc/wget
+usr/share/info
+usr/share/locale
+usr/share/man/man1
--- wget-1.8.2.orig/debian/docs
+++ wget-1.8.2/debian/docs
@@ -0,0 +1,7 @@
+AUTHORS
+ChangeLog.README
+MAILING-LIST
+NEWS
+README
+README.cvs
+TODO
--- wget-1.8.2.orig/debian/rules
+++ wget-1.8.2/debian/rules
@@ -0,0 +1,91 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=3
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+	CFLAGS="$$CFLAGS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -g -Wall" ./configure \
+			--prefix=/usr \
+			--mandir=\$${prefix}/share/man \
+			--infodir=\$${prefix}/share/info \
+			--sysconfdir=/etc \
+			--with-ssl
+
+	touch configure-stamp
+
+build: build-stamp
+
+build-stamp: configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE)
+	#/usr/bin/docbook-to-man debian/wget.sgml > wget.1
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) distclean
+	rm -f doc/wget.inf*
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	# Add here commands to install the package into debian/wget.
+	$(MAKE) install DESTDIR=$(CURDIR)/debian/wget
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdebconf	
+	dh_installdocs
+	dh_installexamples
+#	dh_installmenu
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+#	dh_installcron
+	dh_installman
+	dh_installinfo -a
+#	dh_undocumented
+	dh_installchangelogs ChangeLog
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_makeshlibs
+	dh_installdeb
+#	dh_perl
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- wget-1.8.2.orig/debian/wget.info
+++ wget-1.8.2/debian/wget.info
@@ -0,0 +1 @@
+doc/wget.info*
--- wget-1.8.2.orig/doc/sample.wgetrc
+++ wget-1.8.2/doc/sample.wgetrc
@@ -7,7 +7,7 @@
 ## not contain a comprehensive list of commands -- look at the manual
 ## to find out what you can put into this file.
 ## 
-## Wget initialization file can reside in /usr/local/etc/wgetrc
+## Wget initialization file can reside in /etc/wgetrc
 ## (global, for all users) or $HOME/.wgetrc (for a single user).
 ##
 ## To use the settings in this file, you will have to uncomment them,
@@ -16,7 +16,7 @@
 
 
 ##
-## Global settings (useful for setting up in /usr/local/etc/wgetrc).
+## Global settings (useful for setting up in /etc/wgetrc).
 ## Think well before you change them, since they may reduce wget's
 ## functionality, and make it behave contrary to the documentation:
 ##
@@ -39,7 +39,7 @@
 # connections from the outside.  On these sites you have to use the
 # `passive' feature of FTP.  If you are behind such a firewall, you
 # can turn this on to make Wget use passive FTP by default.
-#passive_ftp = off
+passive_ftp = on
 
 # The "wait" command below makes Wget wait between every connection.
 # If, instead, you want Wget to wait only between retries of failed
--- wget-1.8.2.orig/doc/sample.wgetrc.munged_for_texi_inclusion
+++ wget-1.8.2/doc/sample.wgetrc.munged_for_texi_inclusion
@@ -7,7 +7,7 @@
 ## not contain a comprehensive list of commands -- look at the manual
 ## to find out what you can put into this file.
 ## 
-## Wget initialization file can reside in /usr/local/etc/wgetrc
+## Wget initialization file can reside in /etc/wgetrc
 ## (global, for all users) or $HOME/.wgetrc (for a single user).
 ##
 ## To use the settings in this file, you will have to uncomment them,
@@ -16,7 +16,7 @@
 
 
 ##
-## Global settings (useful for setting up in /usr/local/etc/wgetrc).
+## Global settings (useful for setting up in /etc/wgetrc).
 ## Think well before you change them, since they may reduce wget's
 ## functionality, and make it behave contrary to the documentation:
 ##
@@ -39,7 +39,7 @@
 # connections from the outside.  On these sites you have to use the
 # `passive' feature of FTP.  If you are behind such a firewall, you
 # can turn this on to make Wget use passive FTP by default.
-#passive_ftp = off
+passive_ftp = on
 
 # The "wait" command below makes Wget wait between every connection.
 # If, instead, you want Wget to wait only between retries of failed
--- wget-1.8.2.orig/doc/wget.texi
+++ wget-1.8.2/doc/wget.texi
@@ -2,7 +2,7 @@
 
 @c %**start of header
 @setfilename wget.info
-@settitle GNU Wget Manual
+@settitle GNU Wget - commandline tool for retrieving files using HTTP, HTTPS and FTP
 @c Disable the monstrous rectangles beside overfull hbox-es.
 @finalout
 @c Use `odd' to print double-sided.
@@ -196,12 +196,12 @@
 Most of the features are fully configurable, either through command line
 options, or via the initialization file @file{.wgetrc} (@pxref{Startup
 File}).  Wget allows you to define @dfn{global} startup files
-(@file{/usr/local/etc/wgetrc} by default) for site settings.
+(@file{/etc/wgetrc} by default) for site settings.
 
 @ignore
 @c man begin FILES
 @table @samp
-@item /usr/local/etc/wgetrc
+@item /etc/wgetrc
 Default location of the @dfn{global} startup file.
 
 @item .wgetrc
@@ -507,7 +507,7 @@
 @item -t @var{number}
 @itemx --tries=@var{number}
 Set number of retries to @var{number}.  Specify 0 or @samp{inf} for
-infinite retrying.
+infinite retrying. Default (no command-line switches) is not to retry.
 
 @item -O @var{file}
 @itemx --output-document=@var{file}
@@ -694,7 +694,7 @@
 be expressed in bytes, kilobytes with the @samp{k} suffix, or megabytes
 with the @samp{m} suffix.  For example, @samp{--limit-rate=20k} will
 limit the retrieval rate to 20KB/s.  This kind of thing is useful when,
-for whatever reason, you don't want Wget to consume the entire evailable
+for whatever reason, you don't want Wget to consume the entire available
 bandwidth.
 
 Note that Wget implementeds the limiting by sleeping the appropriate
@@ -1921,8 +1921,8 @@
 @cindex location of wgetrc
 
 When initializing, Wget will look for a @dfn{global} startup file,
-@file{/usr/local/etc/wgetrc} by default (or some prefix other than
-@file{/usr/local}, if Wget was not installed there) and read commands
+@file{/etc/wgetrc} by default (or some prefix other than
+@file{}, if Wget was not installed there) and read commands
 from there, if it exists.
 
 Then it will look for the user's file.  If the environmental variable
@@ -1933,7 +1933,7 @@
 
 The fact that user's settings are loaded after the system-wide ones
 means that in case of collision user's wgetrc @emph{overrides} the
-system-wide wgetrc (in @file{/usr/local/etc/wgetrc} by default).
+system-wide wgetrc (in @file{/etc/wgetrc} by default).
 Fascist admins, away!
 
 @node Wgetrc Syntax, Wgetrc Commands, Wgetrc Location, Startup File
--- wget-1.8.2.orig/src/connect.c
+++ wget-1.8.2/src/connect.c
@@ -88,17 +88,49 @@
 int
 connect_to_one (const unsigned char *addr, unsigned short port, int silent)
 {
+#ifdef INET6
+  struct addrinfo hints, *res;
+  struct sockaddr_storage sock_name;
+  char portstr[NI_MAXSERV];
+  int err;
+#else
   struct sockaddr_in sock_name;
-  int sock, save_errno;
+#endif
+  int sock, save_errno, salen;
 
   /* Set port and protocol */
+#ifdef INET6
+  memset(&hints, 0, sizeof(hints));
+  hints.ai_family = PF_UNSPEC;
+  hints.ai_socktype = SOCK_STREAM;
+  hints.ai_flags = AI_NUMERICHOST;
+  snprintf(portstr, sizeof(portstr), "%d", port);
+  err = getaddrinfo(addr, portstr, &hints, &res);
+  if (err)
+    {
+      if (!silent)
+	logprintf (LOG_VERBOSE, "getaddrinfo: %s.\n", gai_strerror (err));
+      return -1;
+    }
+  memset (&sock_name, 0, sizeof (sock_name));
+  memcpy (&sock_name, res->ai_addr, res->ai_addrlen);
+  salen = res->ai_addrlen;
+  freeaddrinfo (res);
+#else
   sock_name.sin_family = AF_INET;
   sock_name.sin_port = htons (port);
   memcpy ((unsigned char *)&sock_name.sin_addr, addr, 4);
+  salen = sizeof (sock_name);
+#endif
 
   if (!silent)
     {
+#ifdef INET6
+      char pretty_addr[INET6_ADDRSTRLEN];
+      pretty_print_address_sa (&sock_name, salen, pretty_addr);
+#else
       char *pretty_addr = pretty_print_address (addr);
+#endif
       if (connection_host_name
 	  && 0 != strcmp (connection_host_name, pretty_addr))
 	logprintf (LOG_VERBOSE, _("Connecting to %s[%s]:%hu... "),
@@ -109,26 +141,29 @@
     }
 
   /* Make an internet socket, stream type.  */
-  sock = socket (AF_INET, SOCK_STREAM, 0);
+  sock = socket (((struct sockaddr *)&sock_name)->sa_family, SOCK_STREAM, 0);
   if (sock < 0)
     goto out;
 
   if (opt.bind_address)
     {
       /* Bind the client side to the requested address. */
-      if (bind (sock, (struct sockaddr *)opt.bind_address,
-		sizeof (*opt.bind_address)))
+      if (bind (sock, (struct sockaddr *)opt.bind_address, salen))
 	{
-	  close (sock);
+	  save_errno = errno;
+	  CLOSE (sock);
+	  errno = save_errno;
 	  sock = -1;
 	  goto out;
 	}
     }
 
   /* Connect the socket to the remote host.  */
-  if (connect (sock, (struct sockaddr *)&sock_name, sizeof (sock_name)) < 0)
+  if (connect (sock, (struct sockaddr *)&sock_name, salen) < 0)
     {
-      close (sock);
+      save_errno = errno;
+      CLOSE (sock);
+      errno = save_errno;
       sock = -1;
       goto out;
     }
@@ -140,6 +175,10 @@
       if (!silent)
 	logprintf (LOG_VERBOSE, _("connected.\n"));
       DEBUGP (("Created socket %d.\n", sock));
+#ifdef INET6
+      opt.conn_inet6 = ((struct sockaddr *)&sock_name)->sa_family == AF_INET6 ?
+			1 : 0;
+#endif
     }
   else
     {
@@ -161,10 +200,28 @@
   address_list_get_bounds (al, &start, &end);
   for (i = start; i < end; i++)
     {
+#ifdef INET6
+      struct addrinfo ai;
+      unsigned char *addr = (unsigned char *)&ai;
+      char hbuf[INET6_ADDRSTRLEN];
+      int err;
+#else
       unsigned char addr[4];
+#endif
       int sock;
       address_list_copy_one (al, i, addr);
 
+#ifdef INET6
+      err = getnameinfo(ai.ai_addr, ai.ai_addrlen, hbuf, sizeof (hbuf),
+			NULL, 0, NI_NUMERICHOST);
+      if (err)
+	{
+	  if (!silent)
+	    logprintf (LOG_VERBOSE, "getnameinfo: %s.\n", gai_strerror (err));
+	  continue;
+	}
+      addr = (unsigned char *)hbuf;
+#endif
       sock = connect_to_one (addr, port, silent);
       if (sock >= 0)
 	/* Success. */
@@ -217,14 +274,27 @@
    internal variable MPORT is set to the value of the ensuing master
    socket.  Call acceptport() to block for and accept a connection.  */
 uerr_t
-bindport (unsigned short *port)
+bindport_af (unsigned short *port, int af)
 {
   int optval = 1;
+#ifdef INET6
+  static struct sockaddr_storage srv;
+#else
   static struct sockaddr_in srv;
+#endif
+  int alen;
 
   msock = -1;
   addr = (struct sockaddr *) &srv;
-  if ((msock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
+  if (af == AF_INET)
+    alen = sizeof (struct sockaddr_in);
+#ifdef INET6
+  else if (af == AF_INET6)
+    alen = sizeof (struct sockaddr_in6);
+#endif
+  else
+    return CONSOCKERR;
+  if ((msock = socket (af, SOCK_STREAM, 0)) < 0)
     return CONSOCKERR;
   if (setsockopt (msock, SOL_SOCKET, SO_REUSEADDR,
 		  (char *)&optval, sizeof (optval)) < 0)
@@ -232,14 +302,18 @@
 
   if (opt.bind_address == NULL)
     {
-      srv.sin_family = AF_INET;
+      memset (&srv, 0, sizeof (srv));
+      ((struct sockaddr *)&srv)->sa_family = af;
+      /* in6addr_any : all 0 */
+#ifndef INET6
       srv.sin_addr.s_addr = htonl (INADDR_ANY);
+#endif
     }
   else
     srv = *opt.bind_address;
 
-  srv.sin_port = htons (*port);
-  if (bind (msock, addr, sizeof (struct sockaddr_in)) < 0)
+  ((struct sockaddr_in *)&srv)->sin_port = htons (*port); /* same sin6 */
+  if (bind (msock, addr, alen) < 0)
     {
       CLOSE (msock);
       msock = -1;
@@ -251,14 +325,14 @@
       /* #### addrlen should be a 32-bit type, which int is not
          guaranteed to be.  Oh, and don't try to make it a size_t,
          because that can be 64-bit.  */
-      int addrlen = sizeof (struct sockaddr_in);
+      int addrlen = sizeof (srv);
       if (getsockname (msock, addr, &addrlen) < 0)
 	{
 	  CLOSE (msock);
 	  msock = -1;
 	  return CONPORTERR;
 	}
-      *port = ntohs (srv.sin_port);
+      *port = ntohs (((struct sockaddr_in *)addr)->sin_port); /* same sin6 */
     }
   if (listen (msock, 1) < 0)
     {
@@ -269,6 +343,12 @@
   return BINDOK;
 }
 
+uerr_t
+bindport (unsigned short *port)
+{
+  return bindport_af (port, AF_INET);
+}
+
 #ifdef HAVE_SELECT
 /* Wait for file descriptor FD to be readable, MAXTIME being the
    timeout in seconds.  If WRITEP is non-zero, checks for FD being
--- wget-1.8.2.orig/src/connect.h
+++ wget-1.8.2/src/connect.h
@@ -40,6 +40,7 @@
 
 int test_socket_open PARAMS ((int));
 int select_fd PARAMS ((int, int, int));
+uerr_t bindport_af PARAMS ((unsigned short *, int));
 uerr_t bindport PARAMS ((unsigned short *));
 uerr_t acceptport PARAMS ((int *));
 void closeport PARAMS ((int));
--- wget-1.8.2.orig/src/fnmatch.c
+++ wget-1.8.2/src/fnmatch.c
@@ -198,6 +198,17 @@
   return (FNM_NOMATCH);
 }
 
+/* Return non-zero if S has a leading '/'  or contains '../' */
+int
+has_invalid_name (const char *s)
+{
+       if (*s == '/')
+               return 1;
+       if (strstr(s, "../") != 0)
+               return 1;
+       return 0;
+}
+
 /* Return non-zero if S contains globbing wildcards (`*', `?', `[' or
    `]').  */
 int
--- wget-1.8.2.orig/src/ftp-basic.c
+++ wget-1.8.2/src/ftp-basic.c
@@ -45,7 +45,12 @@
 
 #ifdef WINDOWS
 # include <winsock.h>
+#else
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
 #endif
+#include <limits.h>
 
 #include "wget.h"
 #include "utils.h"
@@ -351,6 +356,137 @@
   return FTPOK;
 }
 
+#ifdef INET6
+/* Bind a port and send the appropriate EPRT command to the FTP
+   server.  Use acceptport after RETR, to get the socket of data
+   connection.  */
+uerr_t
+ftp_eprt (struct rbuf *rbuf)
+{
+  uerr_t err;
+  char *request, *respline, *bytes;
+  int nwritten;
+  unsigned short port;
+  struct sockaddr_storage ss;
+  int sslen;
+  char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
+  int af;
+
+  /* Get the address of this side of the connection.  */
+  sslen = sizeof(ss);
+  if (getsockname(RBUF_FD (rbuf), (struct sockaddr *)&ss, &sslen) < 0)
+    return HOSTERR;
+  /* Construct the argument of EPRT. */
+  if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
+	NULL, 0, NI_NUMERICHOST) != 0)
+    return HOSTERR;
+  /* Setting port to 0 lets the system choose a free port.  */
+  port = 0;
+  /* Bind the port.  */
+  err = bindport_af (&port, ((struct sockaddr *)&ss)->sa_family);
+  if (err != BINDOK)
+    return err;
+  sprintf(pbuf, "%u", port);
+  af = ((struct sockaddr *)&ss)->sa_family == AF_INET6 ? 2 : 1;
+  bytes = (char *)alloca (1 + strlen(hbuf) + strlen(pbuf) + 4 + 1);
+  sprintf (bytes, "|%d|%s|%s|", af, hbuf, pbuf);
+  /* Send EPRT request.  */
+  request = ftp_request ("EPRT", bytes);
+  nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
+  if (nwritten < 0)
+    {
+      free (request);
+      return WRITEFAILED;
+    }
+  free (request);
+  /* Get appropriate response.  */
+  err = ftp_response (rbuf, &respline);
+  if (err != FTPOK)
+    {
+      free (respline);
+      return err;
+    }
+  if (*respline != '2')
+    {
+      free (respline);
+      return FTPPORTERR;
+    }
+  free (respline);
+  return FTPOK;
+}
+
+/* Similar to ftp_eprt, but uses `EPSV' to initiate the passive FTP
+   transfer.  Reads the response from server and parses it.  Reads the
+   host and port addresses and returns them.  */
+uerr_t
+ftp_epsv (struct rbuf *rbuf, char *hbuf, unsigned short *pport)
+{
+  char *request, *respline, *s, *ep, delim;
+  long rcv;
+  int nwritten;
+  uerr_t err;
+  struct sockaddr_storage ss;
+  int sslen = sizeof(ss);
+
+  if (getpeername(RBUF_FD (rbuf), (struct sockaddr *)&ss, &sslen) < 0)
+    return HOSTERR;
+  if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, INET6_ADDRSTRLEN,
+	NULL, 0, NI_NUMERICHOST) != 0)
+    return HOSTERR;
+
+  /* Form the request.  */
+  request = ftp_request ("EPSV", NULL);
+  /* And send it.  */
+  nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
+  if (nwritten < 0)
+    {
+      free (request);
+      return WRITEFAILED;
+    }
+  free (request);
+  /* Get the server response.  */
+  err = ftp_response (rbuf, &respline);
+  if (err != FTPOK)
+    goto fin;
+  if (strncmp(respline, "229", 3) != 0)
+    {
+      err = FTPNOPASV;
+      goto fin;
+    }
+  /* Parse the request.  */
+  s = respline;
+  for (s += 4; *s && *s != '('; s++);
+  if (!*s)
+    {
+      err = FTPINVPASV;
+      goto fin;
+    }
+  s++;
+  if (s[0] && s[0] == s[1] && s[0] == s[2])
+    {
+      delim = s[0];
+      s += 3;
+    }
+  else
+    {
+      err = FTPINVPASV;
+      goto fin;
+    }
+  rcv = strtol (s, &ep, 10);
+  if (rcv <= 0 || rcv > USHRT_MAX || *ep != delim)
+    {
+      err = FTPINVPASV;
+      goto fin;
+    }
+  *pport = (unsigned short)rcv;
+  err = FTPOK;
+
+fin:
+  free (respline);
+  return err;
+}
+#endif
+
 /* Sends the TYPE request to the server.  */
 uerr_t
 ftp_type (struct rbuf *rbuf, int type)
@@ -431,7 +567,7 @@
 
 /* Sends REST command to the FTP server.  */
 uerr_t
-ftp_rest (struct rbuf *rbuf, long offset)
+ftp_rest (struct rbuf *rbuf, long long offset)
 {
   char *request, *respline;
   int nwritten;
@@ -645,7 +781,7 @@
 /* Sends the SIZE command to the server, and returns the value in 'size'.
  * If an error occurs, size is set to zero. */
 uerr_t
-ftp_size (struct rbuf *rbuf, const char *file, long int *size)
+ftp_size (struct rbuf *rbuf, const char *file, long long int *size)
 {
   char *request, *respline;
   int nwritten;
@@ -681,7 +817,7 @@
     }
 
   errno = 0;
-  *size = strtol (respline + 4, NULL, 0);
+  *size = strtoll (respline + 4, NULL, 0);
   if (errno) 
     {
       /* 
--- wget-1.8.2.orig/src/ftp.c
+++ wget-1.8.2/src/ftp.c
@@ -43,6 +43,9 @@
 #include <sys/types.h>
 #include <assert.h>
 #include <errno.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 
 #include "wget.h"
 #include "utils.h"
@@ -79,10 +82,10 @@
 /* Look for regexp "( *[0-9]+ *byte" (literal parenthesis) anywhere in
    the string S, and return the number converted to long, if found, 0
    otherwise.  */
-static long
+static long long
 ftp_expected_bytes (const char *s)
 {
-  long res;
+  long long res;
 
   while (1)
     {
@@ -122,7 +125,7 @@
    connection to the server.  It always closes the data connection,
    and closes the control connection in case of error.  */
 static uerr_t
-getftp (struct url *u, long *len, long restval, ccon *con)
+getftp (struct url *u, long long *len, long long restval, ccon *con)
 {
   int csock, dtsock, res;
   uerr_t err;
@@ -132,7 +135,7 @@
   unsigned char pasv_addr[6];
   int cmd = con->cmd;
   int passive_mode_open = 0;
-  long expected_bytes = 0L;
+  long long expected_bytes = 0L;
 
   assert (con != NULL);
   assert (con->target != NULL);
@@ -471,6 +474,7 @@
 	}
 
       err = ftp_size(&con->rbuf, u->file, len);
+//      printf("\ndebug: %lld\n", *len);
       /* FTPRERR */
       switch (err)
 	{
@@ -499,6 +503,54 @@
     {
       if (opt.ftp_pasv > 0)
 	{
+	  unsigned short tport;
+#ifdef INET6
+	  char thost[64];
+
+	  if (!opt.conn_inet6)
+	    goto noepsv;
+	  if (!opt.server_response)
+	    logputs (LOG_VERBOSE, "==> EPSV ... ");
+	  err = ftp_epsv (&con->rbuf, thost, &tport);
+	  /* FTPRERR, WRITEFAILED, FTPNOPASV, FTPINVPASV, HOSTERR */
+	  switch (err)
+	    {
+	    case FTPRERR:
+	      logputs (LOG_VERBOSE, "\n");
+	      logputs (LOG_NOTQUIET, _("\
+Error in server response, closing control connection.\n"));
+	      break;
+	    case WRITEFAILED:
+	      logputs (LOG_VERBOSE, "\n");
+	      logputs (LOG_NOTQUIET,
+		       _("Write failed, closing control connection.\n"));
+	      break;
+	    case FTPNOPASV:
+	      logputs (LOG_VERBOSE, "\n");
+	      logputs (LOG_NOTQUIET, _("Cannot initiate EPSV transfer.\n"));
+	      goto tryeprt;
+	    case FTPINVPASV:
+	      logputs (LOG_VERBOSE, "\n");
+	      logputs (LOG_NOTQUIET, _("Cannot parse EPSV response.\n"));
+	      goto tryeprt;
+	    case HOSTERR:
+	      logputs (LOG_VERBOSE, "\n");
+	      logprintf (LOG_NOTQUIET, "%s: error\n", u->host);
+	      break;
+	    case FTPOK:
+	      /* fine and dandy */
+	      inet_aton(thost, (struct in_addr *)pasv_addr);
+	      goto pasvok;
+	    default:
+	      abort ();
+	      break;
+	    }
+	  CLOSE (csock);
+	  rbuf_uninitialize (&con->rbuf);
+	  return err;
+
+    noepsv:
+#endif
 	  if (!opt.server_response)
 	    logputs (LOG_VERBOSE, "==> PASV ... ");
 	  err = ftp_pasv (&con->rbuf, pasv_addr);
@@ -538,10 +590,17 @@
 	    }
 	  if (err==FTPOK)
 	    {
-	      unsigned short tport;
-
+#ifdef INET6
+	      inet_ntop (AF_INET, pasv_addr, thost, sizeof (thost));
+#endif
 	      tport = (pasv_addr[4] << 8) + pasv_addr[5];
+
+#ifdef INET6
+	pasvok:
+	      dtsock = connect_to_one (thost, tport, 1);
+#else
 	      dtsock = connect_to_one (pasv_addr, tport, 1);
+#endif
 
 	      if (dtsock < 0)
 		{
@@ -549,7 +608,11 @@
 		  CLOSE (csock);
 		  rbuf_uninitialize (&con->rbuf);
 		  logprintf (LOG_VERBOSE, _("couldn't connect to %s:%hu: %s\n"),
+#ifdef INET6
+					thost, tport,
+#else
 			     pretty_print_address (pasv_addr), tport,
+#endif
 			     strerror (save_errno));
 		  return save_errno == ECONNREFUSED ? CONREFUSED : CONERROR;
 		}
@@ -562,6 +625,61 @@
 
       if (!passive_mode_open)   /* Try to use a port command if PASV failed */
 	{
+#ifdef INET6
+	  if (!opt.conn_inet6)
+	    goto noeprt;
+    tryeprt:
+	  if (!opt.server_response)
+	    logputs (LOG_VERBOSE, "==> EPRT ... ");
+	  err = ftp_eprt (&con->rbuf);
+	  /* FTPRERR, WRITEFAILED, bindport (CONSOCKERR, CONPORTERR, BINDERR,
+	     LISTENERR), HOSTERR, FTPPORTERR */
+	  switch (err)
+	    {
+	    case FTPRERR:
+	      logputs (LOG_VERBOSE, "\n");
+	      logputs (LOG_NOTQUIET, _("\
+Error in server response, closing control connection.\n"));
+	      break;
+	    case WRITEFAILED:
+	      logputs (LOG_VERBOSE, "\n");
+	      logputs (LOG_NOTQUIET,
+		       _("Write failed, closing control connection.\n"));
+	      break;
+	    case CONSOCKERR:
+	      logputs (LOG_VERBOSE, "\n");
+	      logprintf (LOG_NOTQUIET, "socket: %s\n", strerror (errno));
+	      break;
+	    case CONPORTERR: case BINDERR: case LISTENERR:
+	      /* What now?  These problems are local...  */
+	      logputs (LOG_VERBOSE, "\n");
+	      logprintf (LOG_NOTQUIET, _("Bind error (%s).\n"),
+			 strerror (errno));
+	      closeport (dtsock);
+	      return err;
+	      break;
+	    case HOSTERR:
+	      logputs (LOG_VERBOSE, "\n");
+	      logprintf (LOG_NOTQUIET, "%s: error\n", u->host);
+	      break;
+	    case FTPPORTERR:
+	      logputs (LOG_VERBOSE, "\n");
+	      logputs (LOG_NOTQUIET, _("Invalid EPRT.\n"));
+	      break;
+	    case FTPOK:
+	      /* fine and dandy */
+	      goto portok;
+	    default:
+	      abort ();
+	      break;
+	    } /* eprt switch */
+	  CLOSE (csock);
+	  closeport (dtsock);
+	  rbuf_uninitialize (&con->rbuf);
+	  return err;
+
+    noeprt:
+#endif
 	  if (!opt.server_response)
 	    logputs (LOG_VERBOSE, "==> PORT ... ");
 	  err = ftp_port (&con->rbuf);
@@ -618,6 +736,9 @@
 	      abort ();
 	      break;
 	    } /* port switch */
+#ifdef INET6
+	portok:
+#endif
 	  if (!opt.server_response)
 	    logputs (LOG_VERBOSE, _("done.    "));
 	} /* dtsock == -1 */
@@ -627,7 +748,7 @@
   if (restval && (cmd & DO_RETR))
     {
       if (!opt.server_response)
-	logprintf (LOG_VERBOSE, "==> REST %ld ... ", restval);
+	logprintf (LOG_VERBOSE, "==> REST %lld ... ", restval);
       err = ftp_rest (&con->rbuf, restval);
 
       /* FTPRERR, WRITEFAILED, FTPRESTFAIL */
@@ -846,18 +967,18 @@
 
   if (*len)
     {
-      logprintf (LOG_VERBOSE, _("Length: %s"), legible (*len));
+      logprintf (LOG_VERBOSE, _("Length: %s"), legible_very_long (*len));
       if (restval)
-	logprintf (LOG_VERBOSE, _(" [%s to go]"), legible (*len - restval));
+	logprintf (LOG_VERBOSE, _(" [%s to go]"), legible_very_long (*len - restval));
       logputs (LOG_VERBOSE, "\n");
       expected_bytes = *len;	/* for get_contents/show_progress */
     }
   else if (expected_bytes)
     {
-      logprintf (LOG_VERBOSE, _("Length: %s"), legible (expected_bytes));
+      logprintf (LOG_VERBOSE, _("Length: %s"), legible_very_long (expected_bytes));
       if (restval)
 	logprintf (LOG_VERBOSE, _(" [%s to go]"),
-		   legible (expected_bytes - restval));
+		   legible_very_long (expected_bytes - restval));
       logputs (LOG_VERBOSE, _(" (unauthoritative)\n"));
     }
 
@@ -980,7 +1101,7 @@
 ftp_loop_internal (struct url *u, struct fileinfo *f, ccon *con)
 {
   int count, orig_lp;
-  long restval, len;
+  long long restval, len;
   char *tms, *tmrate, *locf;
   uerr_t err;
   struct stat st;
@@ -1125,7 +1246,7 @@
 	  CLOSE (RBUF_FD (&con->rbuf));
 	  rbuf_uninitialize (&con->rbuf);
 	}
-      logprintf (LOG_VERBOSE, _("%s (%s) - `%s' saved [%ld]\n\n"),
+      logprintf (LOG_VERBOSE, _("%s (%s) - `%s' saved [%lld]\n\n"),
 		 tms, tmrate, locf, len);
       if (!opt.verbose && !opt.quiet)
 	{
@@ -1133,7 +1254,7 @@
              so that we don't do the needless allocation every
              time. */
 	  char *hurl = url_string (u, 1);
-	  logprintf (LOG_NONVERBOSE, "%s URL: %s [%ld] -> \"%s\" [%d]\n",
+	  logprintf (LOG_NONVERBOSE, "%s URL: %s [%lld] -> \"%s\" [%d]\n",
 		     tms, hurl, len, locf, count);
 	  xfree (hurl);
 	}
@@ -1251,7 +1372,7 @@
   static int depth = 0;
   uerr_t err;
   struct fileinfo *orig;
-  long local_size;
+  long long local_size;
   time_t tml;
   int dlthis;
 
@@ -1339,7 +1460,7 @@
                 {
                   /* Sizes do not match */
                   logprintf (LOG_VERBOSE, _("\
-The sizes do not match (local %ld) -- retrieving.\n\n"), local_size);
+The sizes do not match (local %lld) -- retrieving.\n\n"), local_size);
                 }
             }
 	}	/* opt.timestamping && f->type == FT_PLAINFILE */
@@ -1549,21 +1670,21 @@
 static uerr_t
 ftp_retrieve_glob (struct url *u, ccon *con, int action)
 {
-  struct fileinfo *orig, *start;
+  struct fileinfo *start;
   uerr_t res;
+  struct fileinfo *f;
+         
 
   con->cmd |= LEAVE_PENDING;
 
-  res = ftp_get_listing (u, con, &orig);
+  res = ftp_get_listing (u, con, &start);
   if (res != RETROK)
     return res;
-  start = orig;
   /* First: weed out that do not conform the global rules given in
      opt.accepts and opt.rejects.  */
   if (opt.accepts || opt.rejects)
     {
-      struct fileinfo *f = orig;
-
+       f = start;
       while (f)
 	{
 	  if (f->type != FT_DIRECTORY && !acceptable (f->name))
@@ -1575,6 +1696,18 @@
 	    f = f->next;
 	}
     }
+  /* Remove all files with possible harmful names */
+  f = start;
+  while (f)
+  {
+     if (has_invalid_name(f->name))
+     {
+         logprintf (LOG_VERBOSE, _("Rejecting `%s'.\n"), f->name);
+         f = delelement (f, &start);
+     }
+     else
+         f = f->next;
+  }
   /* Now weed out the files that do not match our globbing pattern.
      If we are dealing with a globbing pattern, that is.  */
   if (*u->file && (action == GLOBALL || action == GETONE))
@@ -1674,13 +1807,13 @@
 		  if (!opt.output_document)
 		    {
 		      struct stat st;
-		      long sz;
+		      long long sz;
 		      if (stat (filename, &st) == 0)
 			sz = st.st_size;
 		      else
 			sz = -1;
 		      logprintf (LOG_NOTQUIET,
-				 _("Wrote HTML-ized index to `%s' [%ld].\n"),
+				 _("Wrote HTML-ized index to `%s' [%lld].\n"),
 				 filename, sz);
 		    }
 		  else
@@ -1701,8 +1834,8 @@
 	  /* ftp_retrieve_glob is a catch-all function that gets called
 	     if we need globbing, time-stamping or recursion.  Its
 	     third argument is just what we really need.  */
-	  ftp_retrieve_glob (u, &con,
-			     (opt.ftp_glob && wild) ? GLOBALL : GETONE);
+	  res = ftp_retrieve_glob (u, &con,
+				   (opt.ftp_glob && wild) ? GLOBALL : GETONE);
 	}
       else
 	res = ftp_loop_internal (u, NULL, &con);
--- wget-1.8.2.orig/src/ftp.h
+++ wget-1.8.2/src/ftp.h
@@ -47,14 +47,18 @@
 uerr_t ftp_login PARAMS ((struct rbuf *, const char *, const char *));
 uerr_t ftp_port PARAMS ((struct rbuf *));
 uerr_t ftp_pasv PARAMS ((struct rbuf *, unsigned char *));
+#ifdef INET6
+uerr_t ftp_eprt PARAMS ((struct rbuf *));
+uerr_t ftp_epsv PARAMS ((struct rbuf *, char *, unsigned short *));
+#endif
 uerr_t ftp_type PARAMS ((struct rbuf *, int));
 uerr_t ftp_cwd PARAMS ((struct rbuf *, const char *));
 uerr_t ftp_retr PARAMS ((struct rbuf *, const char *));
-uerr_t ftp_rest PARAMS ((struct rbuf *, long));
+uerr_t ftp_rest PARAMS ((struct rbuf *, long long));
 uerr_t ftp_list PARAMS ((struct rbuf *, const char *));
 uerr_t ftp_syst PARAMS ((struct rbuf *, enum stype *));
 uerr_t ftp_pwd PARAMS ((struct rbuf *, char **));
-uerr_t ftp_size PARAMS ((struct rbuf *, const char *, long int *));
+uerr_t ftp_size PARAMS ((struct rbuf *, const char *, long long int *));
 
 struct url;
 
@@ -79,7 +83,7 @@
 {
   enum ftype type;		/* file type */
   char *name;			/* file name */
-  long size;			/* file size */
+  long long size;			/* file size */
   long tstamp;			/* time-stamp */
   int perms;			/* file permissions */
   char *linkto;			/* link to which file points */
--- wget-1.8.2.orig/src/headers.c
+++ wget-1.8.2/src/headers.c
@@ -157,7 +157,7 @@
 header_extract_number (const char *header, void *closure)
 {
   const char *p = header;
-  long result;
+  long long result;
 
   for (result = 0; ISDIGIT (*p); p++)
     result = 10 * result + (*p - '0');
@@ -173,7 +173,7 @@
   if (*p)
     return 0;
 
-  *(long *)closure = result;
+  *(long long *)closure = result;
   return 1;
 }
 
--- wget-1.8.2.orig/src/host.c
+++ wget-1.8.2/src/host.c
@@ -87,7 +87,11 @@
 
 struct address_list {
   int count;			/* number of adrresses */
+#ifdef INET6
+  struct addrinfo *addresses;
+#else
   ipv4_address *addresses;	/* pointer to the string of addresses */
+#endif
 
   int faulty;			/* number of addresses known not to
 				   work. */
@@ -110,8 +114,17 @@
 address_list_copy_one (struct address_list *al, int index,
 		       unsigned char *ip_store)
 {
+#ifdef INET6
+  struct addrinfo *ai;
+  assert (index >= al->faulty && index < al->count);
+  for (ai = al->addresses; ai; ai = ai->ai_next, index--)
+    if (index <= 0)
+      break;
+  memcpy (ip_store, ai, sizeof (*ai));
+#else
   assert (index >= al->faulty && index < al->count);
   memcpy (ip_store, al->addresses + index, sizeof (ipv4_address));
+#endif
 }
 
 /* Check whether two address lists have all their IPs in common.  */
@@ -119,12 +132,27 @@
 int
 address_list_match_all (struct address_list *al1, struct address_list *al2)
 {
+#ifdef INET6
+  struct addrinfo *ai1, *ai2;
+#endif
   if (al1 == al2)
     return 1;
   if (al1->count != al2->count)
     return 0;
+#ifdef INET6
+  for (ai1 = al1->addresses, ai2 = al2->addresses; ai1;
+       ai1 = ai1->ai_next, ai2 = ai2->ai_next)
+    {
+      if (ai1->ai_addrlen != ai2->ai_addrlen)
+	return 0;
+      if (memcmp (ai1->ai_addr, ai2->ai_addr, ai1->ai_addrlen))
+	return 0;
+    }
+  return 1;
+#else
   return 0 == memcmp (al1->addresses, al2->addresses,
 		      al1->count * sizeof (ipv4_address));
+#endif
 }
 
 /* Mark the INDEXth element of AL as faulty, so that the next time
@@ -151,26 +179,44 @@
    as returned by gethostbyname.  */
 
 static struct address_list *
+#ifdef INET6
+address_list_new (struct addrinfo *ai)
+{
+  struct addrinfo *res;
+#else
 address_list_new (char **h_addr_list)
 {
-  int count = 0, i;
+  int i;
+#endif
+  int count = 0;
 
   struct address_list *al = xmalloc (sizeof (struct address_list));
 
+#ifdef INET6
+  for (res = ai; res; res = res->ai_next)
+#else
   while (h_addr_list[count])
+#endif
     ++count;
   assert (count > 0);
   al->count     = count;
   al->faulty    = 0;
+#ifdef INET6
+  al->addresses = ai;
+#else
   al->addresses = xmalloc (count * sizeof (ipv4_address));
+#endif
   al->refcount  = 1;
 
+#ifndef INET6
   for (i = 0; i < count; i++)
     memcpy (al->addresses + i, h_addr_list[i], sizeof (ipv4_address));
+#endif
 
   return al;
 }
 
+#ifndef INET6
 /* Like address_list_new, but initialized with only one address. */
 
 static struct address_list *
@@ -185,11 +231,16 @@
 
   return al;
 }
+#endif
 
 static void
 address_list_delete (struct address_list *al)
 {
+#ifdef INET6
+  freeaddrinfo (al->addresses);
+#else
   xfree (al->addresses);
+#endif
   xfree (al);
 }
 
@@ -213,6 +264,17 @@
 {
   return inet_ntoa (*(struct in_addr *)addr);
 }
+#ifdef INET6
+int
+pretty_print_address_sa (const void *addr, int alen, char *abuf)
+{
+  int err = getnameinfo((struct sockaddr *)addr, alen, abuf, INET6_ADDRSTRLEN,
+			NULL, 0, NI_NUMERICHOST);
+  if (err)
+    strcpy (abuf, "???");
+  return err;
+}
+#endif
 
 /* Add host name HOST with the address ADDR_TEXT to the cache.
    ADDR_LIST is a NULL-terminated list of addresses, as in struct
@@ -230,10 +292,23 @@
 #ifdef DEBUG
   if (opt.debug)
     {
+#ifdef INET6
+      struct addrinfo *ai;
+#else
       int i;
+#endif
       debug_logprintf ("Caching %s =>", host);
+#ifdef INET6
+      for (ai = al->addresses; ai; ai = ai->ai_next)
+	{
+	  char hbuf[INET6_ADDRSTRLEN];
+	  pretty_print_address_sa (ai->ai_addr, ai->ai_addrlen, hbuf);
+	  debug_logprintf (" %s", hbuf);
+	}
+#else
       for (i = 0; i < al->count; i++)
 	debug_logprintf (" %s", pretty_print_address (al->addresses + i));
+#endif
       debug_logprintf ("\n");
     }
 #endif
@@ -243,6 +318,24 @@
 lookup_host (const char *host, int silent)
 {
   struct address_list *al = NULL;
+#ifdef INET6
+  struct addrinfo hints, *res;
+  int error;
+
+  memset(&hints, 0, sizeof(hints));
+  if (opt.inet)
+    hints.ai_family = AF_INET;
+  else if (opt.inet6)
+    hints.ai_family = AF_INET6;
+  else
+    hints.ai_family = AF_UNSPEC;
+  hints.ai_socktype = SOCK_STREAM;
+  hints.ai_flags = AI_NUMERICHOST;
+  /* check `N.N.N.N' or 'X:X:X:X:X:X:X:X'. */
+  if (!getaddrinfo(host, NULL, &hints, &res))
+    return address_list_new (res);
+
+#else
   unsigned long addr;
   struct hostent *hptr;
 
@@ -264,6 +357,7 @@
 #endif
       return address_list_new_one ((char *)&addr + offset);
     }
+#endif /* INET6 */
 
   /* By now we know that the host name we got is not of the form
      d.d.d.d.  Try to find it in our cache of host names.  */
@@ -280,12 +374,29 @@
   if (!silent)
     logprintf (LOG_VERBOSE, _("Resolving %s... "), host);
 
+#ifdef INET6
+  memset(&hints, 0, sizeof(hints));
+  if (opt.inet)
+    hints.ai_family = AF_INET;
+  else if (opt.inet6)
+    hints.ai_family = AF_INET6;
+  else
+    hints.ai_family = AF_UNSPEC;
+  hints.ai_socktype = SOCK_STREAM;
+  error = getaddrinfo(host, NULL, &hints, &res);
+  if (error)
+#else
   /* Look up the host using gethostbyname().  */
   hptr = gethostbyname (host);
   if (!hptr)
+#endif
     {
       if (!silent)
+#ifdef INET6
+	logprintf (LOG_VERBOSE, _("failed: %s.\n"), gai_strerror(error));
+#else
 	logprintf (LOG_VERBOSE, _("failed: %s.\n"), herrmsg (h_errno));
+#endif
       return NULL;
     }
 
@@ -294,7 +405,11 @@
 
   /* Do all systems have h_addr_list, or is it a newer thing?  If the
      latter, use address_list_new_one.  */
+#ifdef INET6
+  al = address_list_new (res);
+#else
   al = address_list_new (hptr->h_addr_list);
+#endif
 
   /* Cache the lookup information. */
   cache_host_lookup (host, al);
--- wget-1.8.2.orig/src/host.h
+++ wget-1.8.2/src/host.h
@@ -48,6 +48,9 @@
 /* This was originally going to be a macro, but then every caller
    would have to #include the netinet stuff.  */
 char *pretty_print_address PARAMS ((const void *));
+#ifdef INET6
+int pretty_print_address_sa PARAMS ((const void *, int, char *));
+#endif
 
 int accept_domain PARAMS ((struct url *));
 int sufmatch PARAMS ((const char **, const char *));
--- wget-1.8.2.orig/src/http.c
+++ wget-1.8.2/src/http.c
@@ -185,7 +185,7 @@
 struct http_process_range_closure {
   long first_byte_pos;
   long last_byte_pos;
-  long entity_length;
+  long long entity_length;
 };
 
 /* Parse the `Content-Range' header and extract the information it
@@ -485,9 +485,9 @@
 
 struct http_stat
 {
-  long len;			/* received length */
-  long contlen;			/* expected length */
-  long restval;			/* the restart value */
+  long long len;			/* received length */
+  long long contlen;			/* expected length */
+  long long restval;			/* the restart value */
   int res;			/* the result of last read */
   char *newloc;			/* new location (redirection) */
   char *remote_time;		/* remote time-stamp string */
@@ -550,8 +550,8 @@
   char *all_headers;
   char *port_maybe;
   char *request_keep_alive;
-  int sock, hcount, num_written, all_length, statcode;
-  long contlen, contrange;
+  int sock, hcount, num_written, statcode;
+  long long contlen, all_length, contrange;
   struct url *conn;
   FILE *fp;
   int auth_tried_already;
@@ -573,6 +573,11 @@
   /* Whether keep-alive should be inhibited. */
   int inhibit_keep_alive;
 
+  /* Whether we need to print the host header with braces around host,
+     e.g. "Host: [3ffe:8100:200:2::2]:1234" instead of the usual
+     "Host: symbolic-name:1234". */
+  int squares_around_host = 0;
+
 #ifdef HAVE_SSL
   /* initialize ssl_ctx on first run */
   if (!ssl_ctx)
@@ -712,7 +717,7 @@
          HTTP/1.1 specifies a multipart/byte-ranges MIME type, but
          only if multiple non-overlapping ranges are requested --
          which Wget never does.  */
-      sprintf (range, "Range: bytes=%ld-\r\n", hs->restval);
+      sprintf (range, "Range: bytes=%lld-\r\n", hs->restval);
     }
   else
     range = NULL;
@@ -825,6 +830,9 @@
        "param=value", full_path will be "/foo/bar?param=value".  */
     full_path = url_full_path (u);
 
+  if (strchr (u->host, ':'))
+    squares_around_host = 1;
+
   /* Allocate the memory for the request.  */
   request = (char *)alloca (strlen (command)
 			    + strlen (full_path)
@@ -846,11 +854,12 @@
   sprintf (request, "\
 %s %s HTTP/1.0\r\n\
 User-Agent: %s\r\n\
-Host: %s%s\r\n\
+Host: %s%s%s%s\r\n\
 Accept: %s\r\n\
 %s%s%s%s%s%s%s%s\r\n",
 	   command, full_path,
-	   useragent, u->host,
+	   useragent,
+	   squares_around_host ? "[" : "", u->host, squares_around_host ? "]" : "",
 	   port_maybe ? port_maybe : "",
 	   HTTP_ACCEPT,
 	   request_keep_alive ? request_keep_alive : "",
@@ -1288,10 +1297,10 @@
 	  logputs (LOG_VERBOSE, _("Length: "));
 	  if (contlen != -1)
 	    {
-	      logputs (LOG_VERBOSE, legible (contlen));
+	      logputs (LOG_VERBOSE, legible_very_long (contlen));
 	      if (contrange != -1)
 		logprintf (LOG_VERBOSE, _(" (%s to go)"),
-			   legible (contlen - contrange));
+			   legible_very_long (contlen - contrange));
 	    }
 	  else
 	    logputs (LOG_VERBOSE,
@@ -1409,7 +1418,7 @@
   char *tms, *suf, *locf, *tmrate;
   uerr_t err;
   time_t tml = -1, tmr = -1;	/* local and remote time-stamps */
-  long local_size = 0;		/* the size of the local file */
+  long long local_size = 0;		/* the size of the local file */
   size_t filename_len;
   struct http_stat hstat;	/* HTTP status */
   struct stat st;
@@ -1732,7 +1741,7 @@
 		}
 	      else if (tml >= tmr)
 		logprintf (LOG_VERBOSE, _("\
-The sizes do not match (local %ld) -- retrieving.\n"), local_size);
+The sizes do not match (local %lld) -- retrieving.\n"), local_size);
 	      else
 		logputs (LOG_VERBOSE,
 			 _("Remote file is newer, retrieving.\n"));
@@ -1768,7 +1777,7 @@
 	  FREE_MAYBE (dummy);
 	  return RETROK;
 	}
-
+//      fprintf(stderr, "test: hstat.len: %lld, hstat.restval: %lld\n", hstat.dltime);
       tmrate = retr_rate (hstat.len - hstat.restval, hstat.dltime, 0);
 
       if (hstat.len == hstat.contlen)
@@ -1776,10 +1785,10 @@
 	  if (*dt & RETROKF)
 	    {
 	      logprintf (LOG_VERBOSE,
-			 _("%s (%s) - `%s' saved [%ld/%ld]\n\n"),
+			 _("%s (%s) - `%s' saved [%lld/%lld]\n\n"),
 			 tms, tmrate, locf, hstat.len, hstat.contlen);
 	      logprintf (LOG_NONVERBOSE,
-			 "%s URL:%s [%ld/%ld] -> \"%s\" [%d]\n",
+			 "%s URL:%s [%lld/%lld] -> \"%s\" [%d]\n",
 			 tms, u->url, hstat.len, hstat.contlen, locf, count);
 	    }
 	  ++opt.numurls;
@@ -1803,10 +1812,10 @@
 	      if (*dt & RETROKF)
 		{
 		  logprintf (LOG_VERBOSE,
-			     _("%s (%s) - `%s' saved [%ld]\n\n"),
+			     _("%s (%s) - `%s' saved [%lld]\n\n"),
 			     tms, tmrate, locf, hstat.len);
 		  logprintf (LOG_NONVERBOSE,
-			     "%s URL:%s [%ld] -> \"%s\" [%d]\n",
+			     "%s URL:%s [%lld] -> \"%s\" [%d]\n",
 			     tms, u->url, hstat.len, locf, count);
 		}
 	      ++opt.numurls;
@@ -1826,7 +1835,7 @@
 						 connection too soon */
 	    {
 	      logprintf (LOG_VERBOSE,
-			 _("%s (%s) - Connection closed at byte %ld. "),
+			 _("%s (%s) - Connection closed at byte %lld. "),
 			 tms, tmrate, hstat.len);
 	      printwhat (count, opt.ntry);
 	      free_hstat (&hstat);
@@ -1835,10 +1844,10 @@
 	  else if (!opt.kill_longer) /* meaning we got more than expected */
 	    {
 	      logprintf (LOG_VERBOSE,
-			 _("%s (%s) - `%s' saved [%ld/%ld])\n\n"),
+			 _("%s (%s) - `%s' saved [%lld/%lld])\n\n"),
 			 tms, tmrate, locf, hstat.len, hstat.contlen);
 	      logprintf (LOG_NONVERBOSE,
-			 "%s URL:%s [%ld/%ld] -> \"%s\" [%d]\n",
+			 "%s URL:%s [%lld/%lld] -> \"%s\" [%d]\n",
 			 tms, u->url, hstat.len, hstat.contlen, locf, count);
 	      ++opt.numurls;
 	      downloaded_increase (hstat.len);
@@ -1856,7 +1865,7 @@
 	  else			/* the same, but not accepted */
 	    {
 	      logprintf (LOG_VERBOSE,
-			 _("%s (%s) - Connection closed at byte %ld/%ld. "),
+			 _("%s (%s) - Connection closed at byte %lld/%lld. "),
 			 tms, tmrate, hstat.len, hstat.contlen);
 	      printwhat (count, opt.ntry);
 	      free_hstat (&hstat);
@@ -1868,7 +1877,7 @@
 	  if (hstat.contlen == -1)
 	    {
 	      logprintf (LOG_VERBOSE,
-			 _("%s (%s) - Read error at byte %ld (%s)."),
+			 _("%s (%s) - Read error at byte %lld (%s)."),
 			 tms, tmrate, hstat.len, strerror (errno));
 	      printwhat (count, opt.ntry);
 	      free_hstat (&hstat);
@@ -1877,7 +1886,7 @@
 	  else			/* hstat.res == -1 and contlen is given */
 	    {
 	      logprintf (LOG_VERBOSE,
-			 _("%s (%s) - Read error at byte %ld/%ld (%s). "),
+			 _("%s (%s) - Read error at byte %lld/%lld (%s). "),
 			 tms, tmrate, hstat.len, hstat.contlen,
 			 strerror (errno));
 	      printwhat (count, opt.ntry);
--- wget-1.8.2.orig/src/init.c
+++ wget-1.8.2/src/init.c
@@ -48,6 +48,7 @@
 #else
 # include <sys/socket.h>
 # include <netinet/in.h>
+# include <netdb.h>
 #ifndef __BEOS__
 # include <arpa/inet.h>
 #endif
@@ -152,6 +153,10 @@
   { "ignorelength",	&opt.ignore_length,	cmd_boolean },
   { "ignoretags",	&opt.ignore_tags,	cmd_vector },
   { "includedirectories", &opt.includes,	cmd_directory_vector },
+#ifdef INET6
+  { "inet",		&opt.inet,		cmd_boolean },
+  { "inet6",		&opt.inet6,		cmd_boolean },
+#endif
   { "input",		&opt.input_filename,	cmd_file },
   { "killlonger",	&opt.kill_longer,	cmd_boolean },
   { "limitrate",	&opt.limit_rate,	cmd_bytes },
@@ -536,10 +541,18 @@
 cmd_address (const char *com, const char *val, void *closure)
 {
   struct address_list *al;
+#ifdef INET6
+  struct addrinfo ai;
+  struct sockaddr_storage ss;
+  int slen;
+#else
   struct sockaddr_in sin;
+#endif
   struct sockaddr_in **target = (struct sockaddr_in **)closure;
 
+#ifndef INET6
   memset (&sin, '\0', sizeof (sin));
+#endif
 
   al = lookup_host (val, 1);
   if (!al)
@@ -548,16 +561,29 @@
 	       exec_name, com, val);
       return 0;
     }
+#ifdef INET6
+  address_list_copy_one (al, 0, (unsigned char *)&ai);
+  slen = ai.ai_addrlen;
+  memcpy (&ss, ai.ai_addr, slen);
+#else
   address_list_copy_one (al, 0, (unsigned char *)&sin.sin_addr);
+#endif
   address_list_release (al);
 
+#ifndef INET6
   sin.sin_family = AF_INET;
   sin.sin_port = 0;
+#endif
 
   FREE_MAYBE (*target);
 
+#ifdef INET6
+  *target = xmalloc (sizeof (ss));
+  memcpy (*target, &ss, slen);
+#else
   *target = xmalloc (sizeof (sin));
   memcpy (*target, &sin, sizeof (sin));
+#endif
 
   return 1;
 }
--- wget-1.8.2.orig/src/main.c
+++ wget-1.8.2/src/main.c
@@ -181,6 +181,12 @@
   -Q,  --quota=NUMBER           set retrieval quota to NUMBER.\n\
        --limit-rate=RATE        limit download rate to RATE.\n\
 \n"), stdout);
+#ifdef INET6
+  fputs (_("\
+       --inet                   use IP version 4 socket.\n\
+       --inet6                  use IP version 6 socket.\n\
+\n"), stdout);
+#endif /* INET6 */
   fputs (_("\
 Directories:\n\
   -nd  --no-directories            don\'t create directories.\n\
@@ -266,6 +272,10 @@
     { "help", no_argument, NULL, 'h' },
     { "html-extension", no_argument, NULL, 'E' },
     { "ignore-length", no_argument, NULL, 138 },
+#ifdef INET6
+    { "inet", no_argument, NULL, '4' },
+    { "inet6", no_argument, NULL, '6' },
+#endif
     { "mirror", no_argument, NULL, 'm' },
     { "no-clobber", no_argument, NULL, 141 },
     { "no-directories", no_argument, NULL, 147 },
@@ -417,6 +427,16 @@
 	case 165:
 	  setval ("randomwait", "on");
 	  break;
+#ifdef INET6
+	case '4':
+	  setval ("inet", "on");
+	  setval ("inet6", "off");
+	  break;
+	case '6':
+	  setval ("inet6", "on");
+	  setval ("inet", "off");
+	  break;
+#endif
 	case 'b':
 	  setval ("background", "on");
 	  break;
@@ -713,6 +733,14 @@
       print_usage ();
       exit (1);
     }
+#ifdef INET6
+  if (opt.inet && opt.inet6)
+    {
+      printf (_("Can't inet and inet6 be specified at the same time.\n"));
+      print_usage ();
+      exit (1);
+    }
+#endif
   if (opt.timestamping && opt.noclobber)
     {
       printf (_("\
--- wget-1.8.2.orig/src/netrc.c
+++ wget-1.8.2/src/netrc.c
@@ -328,9 +328,12 @@
 	    p ++;
 	  }
 
-	  /* if field was quoted, squash the trailing quotation mark */
-	  if (quote)
+          /* if field was quoted, squash the trailing quotation mark
+             and reset quote flag */
+	  if (quote) {
 	    shift_left(p);
+            quote = 0;
+          }
 
 	  /* Null-terminate the token, if it isn't already.  */
 	  if (*p)
--- wget-1.8.2.orig/src/options.h
+++ wget-1.8.2/src/options.h
@@ -163,7 +163,14 @@
   int page_requisites;		/* Whether we need to download all files
 				   necessary to display a page properly. */
 
+#ifdef INET6
+  int inet;
+  int inet6;
+  int conn_inet6;		/* connect IPv6? */
+  struct sockaddr_storage *bind_address;
+#else
   struct sockaddr_in *bind_address; /* What local IP address to bind to. */
+#endif
 
 #ifdef HAVE_SSL
   char *sslcertfile;		/* external client cert to use. */
--- wget-1.8.2.orig/src/progress.c
+++ wget-1.8.2/src/progress.c
@@ -51,21 +51,21 @@
 
 struct progress_implementation {
   char *name;
-  void *(*create) PARAMS ((long, long));
-  void (*update) PARAMS ((void *, long, long));
+  void *(*create) PARAMS ((long long, long long));
+  void (*update) PARAMS ((void *, long long, long));
   void (*finish) PARAMS ((void *, long));
   void (*set_params) PARAMS ((const char *));
 };
 
 /* Necessary forward declarations. */
 
-static void *dot_create PARAMS ((long, long));
-static void dot_update PARAMS ((void *, long, long));
+static void *dot_create PARAMS ((long long, long long));
+static void dot_update PARAMS ((void *, long long, long));
 static void dot_finish PARAMS ((void *, long));
 static void dot_set_params PARAMS ((const char *));
 
-static void *bar_create PARAMS ((long, long));
-static void bar_update PARAMS ((void *, long, long));
+static void *bar_create PARAMS ((long long, long long));
+static void bar_update PARAMS ((void *, long long, long));
 static void bar_finish PARAMS ((void *, long));
 static void bar_set_params PARAMS ((const char *));
 
@@ -155,7 +155,7 @@
    advance.  */
 
 void *
-progress_create (long initial, long total)
+progress_create (long long initial, long long total)
 {
   /* Check if the log status has changed under our feet. */
   if (output_redirected)
@@ -189,9 +189,9 @@
 /* Dot-printing. */
 
 struct dot_progress {
-  long initial_length;		/* how many bytes have been downloaded
+  long long initial_length;		/* how many bytes have been downloaded
 				   previously. */
-  long total_length;		/* expected total byte count when the
+  long long int total_length;		/* expected total byte count when the
 				   download finishes */
 
   int accumulated;
@@ -204,7 +204,7 @@
 /* Dot-progress backend for progress_create. */
 
 static void *
-dot_create (long initial, long total)
+dot_create (long long initial, long long int total)
 {
   struct dot_progress *dp = xmalloc (sizeof (struct dot_progress));
 
@@ -216,14 +216,14 @@
   if (dp->initial_length)
     {
       int dot_bytes = opt.dot_bytes;
-      long row_bytes = opt.dot_bytes * opt.dots_in_line;
+      long long row_bytes = opt.dot_bytes * opt.dots_in_line;
 
       int remainder = (int) (dp->initial_length % row_bytes);
-      long skipped = dp->initial_length - remainder;
+      long long skipped = dp->initial_length - remainder;
 
       if (skipped)
 	{
-	  int skipped_k = (int) (skipped / 1024); /* skipped amount in K */
+	  long long int skipped_k = (long long int) (skipped / 1024); /* skipped amount in K */
 	  int skipped_k_len = numdigit (skipped_k);
 	  if (skipped_k_len < 5)
 	    skipped_k_len = 5;
@@ -231,11 +231,11 @@
 	  /* Align the [ skipping ... ] line with the dots.  To do
 	     that, insert the number of spaces equal to the number of
 	     digits in the skipped amount in K.  */
-	  logprintf (LOG_VERBOSE, _("\n%*s[ skipping %dK ]"),
+	  logprintf (LOG_VERBOSE, _("\n%*s[ skipping %lldK ]"),
 		     2 + skipped_k_len, "", skipped_k);
 	}
 
-      logprintf (LOG_VERBOSE, "\n%5ldK", skipped / 1024);
+      logprintf (LOG_VERBOSE, "\n%5lldK", skipped / 1024);
       for (; remainder >= dot_bytes; remainder -= dot_bytes)
 	{
 	  if (dp->dots % opt.dot_spacing == 0)
@@ -253,14 +253,14 @@
 }
 
 static void
-print_percentage (long bytes, long expected)
+print_percentage (long long int bytes, long long int expected)
 {
   int percentage = (int)(100.0 * bytes / expected);
   logprintf (LOG_VERBOSE, "%3d%%", percentage);
 }
 
 static void
-print_download_speed (struct dot_progress *dp, long bytes, long dltime)
+print_download_speed (struct dot_progress *dp, long long bytes, long dltime)
 {
   logprintf (LOG_VERBOSE, " %s",
 	     retr_rate (bytes, dltime - dp->last_timer_value, 1));
@@ -270,11 +270,11 @@
 /* Dot-progress backend for progress_update. */
 
 static void
-dot_update (void *progress, long howmuch, long dltime)
+dot_update (void *progress, long long howmuch, long dltime)
 {
   struct dot_progress *dp = progress;
   int dot_bytes = opt.dot_bytes;
-  long row_bytes = opt.dot_bytes * opt.dots_in_line;
+  long long row_bytes = opt.dot_bytes * opt.dots_in_line;
 
   log_set_flush (0);
 
@@ -282,7 +282,7 @@
   for (; dp->accumulated >= dot_bytes; dp->accumulated -= dot_bytes)
     {
       if (dp->dots == 0)
-	logprintf (LOG_VERBOSE, "\n%5ldK", dp->rows * row_bytes / 1024);
+	logprintf (LOG_VERBOSE, "\n%5lldK", dp->rows * row_bytes / 1024);
 
       if (dp->dots % opt.dot_spacing == 0)
 	logputs (LOG_VERBOSE, " ");
@@ -291,7 +291,7 @@
       ++dp->dots;
       if (dp->dots >= opt.dots_in_line)
 	{
-	  long row_qty = row_bytes;
+	  long long row_qty = row_bytes;
 	  if (dp->rows == dp->initial_length / row_bytes)
 	    row_qty -= dp->initial_length % row_bytes;
 
@@ -414,11 +414,11 @@
 static int screen_width = DEFAULT_SCREEN_WIDTH;
 
 struct bar_progress {
-  long initial_length;		/* how many bytes have been downloaded
+  long long initial_length;		/* how many bytes have been downloaded
 				   previously. */
-  long total_length;		/* expected total byte count when the
+  long long total_length;		/* expected total byte count when the
 				   download finishes */
-  long count;			/* bytes downloaded so far */
+  long long count;			/* bytes downloaded so far */
 
   long last_update;		/* time of the last screen update. */
 
@@ -437,7 +437,7 @@
 static void display_image PARAMS ((char *));
 
 static void *
-bar_create (long initial, long total)
+bar_create (long long initial, long long total)
 {
   struct bar_progress *bp = xmalloc (sizeof (struct bar_progress));
 
@@ -465,7 +465,7 @@
 }
 
 static void
-bar_update (void *progress, long howmuch, long dltime)
+bar_update (void *progress, long long howmuch, long dltime)
 {
   struct bar_progress *bp = progress;
   int force_update = 0;
@@ -535,9 +535,9 @@
 create_image (struct bar_progress *bp, long dltime)
 {
   char *p = bp->buffer;
-  long size = bp->initial_length + bp->count;
+  long long size = bp->initial_length + bp->count;
 
-  char *size_legible = legible (size);
+  char *size_legible = legible_very_long (size);
   int size_legible_len = strlen (size_legible);
 
   /* The progress bar should look like this:
@@ -633,7 +633,7 @@
     }
 
   /* " 234,567,890" */
-  sprintf (p, " %-11s", legible (size));
+  sprintf (p, " %-11s", legible_very_long (size));
   p += strlen (p);
 
   /* " 1012.45K/s" */
@@ -653,7 +653,7 @@
     {
       int eta, eta_hrs, eta_min, eta_sec;
       double tm_sofar = (double)dltime / 1000;
-      long bytes_remaining = bp->total_length - size;
+      long long bytes_remaining = bp->total_length - size;
 
       eta = (int) (tm_sofar * bytes_remaining / bp->count);
 
--- wget-1.8.2.orig/src/progress.h
+++ wget-1.8.2/src/progress.h
@@ -34,7 +34,7 @@
 void set_progress_implementation PARAMS ((const char *));
 void progress_schedule_redirect PARAMS ((void));
 
-void *progress_create PARAMS ((long, long));
+void *progress_create PARAMS ((long long, long long));
 void progress_update PARAMS ((void *, long, long));
 void progress_finish PARAMS ((void *, long));
 
--- wget-1.8.2.orig/src/retr.c
+++ wget-1.8.2/src/retr.c
@@ -65,9 +65,8 @@
 /* See the comment in gethttp() why this is needed. */
 int global_download_count;
 
-
 static struct {
-  long bytes;
+  long long bytes;
   long dltime;
 } limit_data;
 
@@ -84,25 +83,25 @@
    TIMER the timer, and ADJUSTMENT the previous.  */
 
 static void
-limit_bandwidth (long bytes, long delta)
+limit_bandwidth (long long bytes, long long delta)
 {
-  long expected;
+  long long expected;
 
   limit_data.bytes += bytes;
   limit_data.dltime += delta;
 
-  expected = (long)(1000.0 * limit_data.bytes / opt.limit_rate);
+  expected = (long long)(1000.0 * limit_data.bytes / opt.limit_rate);
 
   if (expected > limit_data.dltime)
     {
-      long slp = expected - limit_data.dltime;
+      long long slp = expected - limit_data.dltime;
       if (slp < 200)
 	{
-	  DEBUGP (("deferring a %ld ms sleep (%ld/%ld) until later.\n",
+	  DEBUGP (("deferring a %lld ms sleep (%lld/%ld) until later.\n",
 		   slp, limit_data.bytes, limit_data.dltime));
 	  return;
 	}
-      DEBUGP (("sleeping %ld ms\n", slp));
+      DEBUGP (("sleeping %lld ms\n", slp));
       usleep (1000 * slp);
     }
 
@@ -134,7 +133,7 @@
    rbuf_flush() before actually reading from fd.  If you wish to read
    from fd immediately, flush or discard the buffer.  */
 int
-get_contents (int fd, FILE *fp, long *len, long restval, long expected,
+get_contents (int fd, FILE *fp, long long *len, long long restval, long long expected,
 	      struct rbuf *rbuf, int use_expected, long *elapsed)
 {
   int res = 0;
@@ -236,7 +235,7 @@
    appropriate for the speed.  If PAD is non-zero, strings will be
    padded to the width of 7 characters (xxxx.xx).  */
 char *
-retr_rate (long bytes, long msecs, int pad)
+retr_rate (long long bytes, long long msecs, int pad)
 {
   static char res[20];
   static char *rate_names[] = {"B/s", "KB/s", "MB/s", "GB/s" };
@@ -256,7 +255,7 @@
    UNITS is zero for B/s, one for KB/s, two for MB/s, and three for
    GB/s.  */
 double
-calc_rate (long bytes, long msecs, int *units)
+calc_rate (long long bytes, long long msecs, int *units)
 {
   double dlrate;
 
@@ -621,7 +620,7 @@
 /* Increment opt.downloaded by BY_HOW_MUCH.  If an overflow occurs,
    set opt.downloaded_overflow to 1. */
 void
-downloaded_increase (unsigned long by_how_much)
+downloaded_increase (unsigned long long by_how_much)
 {
   VERY_LONG_TYPE old;
   if (opt.downloaded_overflow)
--- wget-1.8.2.orig/src/retr.h
+++ wget-1.8.2/src/retr.h
@@ -32,18 +32,18 @@
 
 #include "rbuf.h"
 
-int get_contents PARAMS ((int, FILE *, long *, long, long, struct rbuf *,
+int get_contents PARAMS ((int, FILE *, long long *, long long, long long, struct rbuf *,
 			  int, long *));
 
 uerr_t retrieve_url PARAMS ((const char *, char **, char **,
 			     const char *, int *));
 uerr_t retrieve_from_file PARAMS ((const char *, int, int *));
 
-char *retr_rate PARAMS ((long, long, int));
-double calc_rate PARAMS ((long, long, int *));
+char *retr_rate PARAMS ((long long, long long, int));
+double calc_rate PARAMS ((long long, long long, int *));
 void printwhat PARAMS ((int, int));
 
-void downloaded_increase PARAMS ((unsigned long));
+void downloaded_increase PARAMS ((unsigned long long));
 int downloaded_exceeds_quota PARAMS ((void));
 
 void sleep_between_retrievals PARAMS ((int));
--- wget-1.8.2.orig/src/url.c
+++ wget-1.8.2/src/url.c
@@ -121,7 +121,7 @@
  RU,  0,  0,  0,   0,  0,  0,  0,   /* @   A   B   C    D   E   F   G   */
   0,  0,  0,  0,   0,  0,  0,  0,   /* H   I   J   K    L   M   N   O   */
   0,  0,  0,  0,   0,  0,  0,  0,   /* P   Q   R   S    T   U   V   W   */
-  0,  0,  0,  U,   U,  U,  U,  0,   /* X   Y   Z   [    \   ]   ^   _   */
+  0,  0,  0, RU,   U, RU,  U,  0,   /* X   Y   Z   [    \   ]   ^   _   */
   U,  0,  0,  0,   0,  0,  0,  0,   /* `   a   b   c    d   e   f   g   */
   0,  0,  0,  0,   0,  0,  0,  0,   /* h   i   j   k    l   m   n   o   */
   0,  0,  0,  0,   0,  0,  0,  0,   /* p   q   r   s    t   u   v   w   */
@@ -641,7 +641,11 @@
 #define PE_BAD_PORT_NUMBER     3
   "Bad port number",
 #define PE_INVALID_USER_NAME   4
-  "Invalid user name"
+  "Invalid user name",
+#define PE_UNTERMINATED_IPV6_ADDRESS 5
+  "Unterminated IPv6 numeric address",
+#define PE_INVALID_IPV6_ADDRESS 6
+  "Invalid char in IPv6 numeric address"
 };
 
 #define SETERR(p, v) do {			\
@@ -703,8 +707,45 @@
   fragment_b = fragment_e = NULL;
 
   host_b = p;
-  p = strpbrk_or_eos (p, ":/;?#");
-  host_e = p;
+
+  if (*p == '[')
+    {
+      /* Support http://[::1]/ used by IPv6. */
+      int invalid = 0;
+      ++p;
+      while (1)
+	{
+	  char c = *p++;
+	  switch (c)
+	    {
+	    case ']':
+	      goto out;
+	    case '\0':
+	      SETERR (error, PE_UNTERMINATED_IPV6_ADDRESS);
+	      return NULL;
+	    case ':': case '.':
+	      break;
+	    default:
+	      if (ISXDIGIT (c))
+		break;
+	      invalid = 1;
+	    }
+	}
+    out:
+      if (invalid)
+	{
+	  SETERR (error, PE_INVALID_IPV6_ADDRESS);
+	  return NULL;
+	}
+      /* Don't include brackets in [host_b, host_p). */
+      ++host_b;
+      host_e = p - 1;
+    }
+  else
+    {
+      p = strpbrk_or_eos (p, ":/;?#");
+      host_e = p;
+    }
 
   if (host_b == host_e)
     {
@@ -1290,12 +1331,13 @@
 compose_file_name (char *base, char *query)
 {
   char result[256];
+  const size_t max_size = sizeof(result) - 3; /* Make sure we can expand if needed */
   char *from;
   char *to = result;
 
   /* Copy BASE to RESULT and encode all unsafe characters.  */
   from = base;
-  while (*from && to - result < sizeof (result))
+  while (*from && to - result < max_size)
     {
       if (UNSAFE_CHAR (*from))
 	{
@@ -1308,7 +1350,7 @@
 	*to++ = *from++;
     }
 
-  if (query && to - result < sizeof (result))
+  if (query && to - result < max_size)
     {
 #if WINDOWS || __CYGWIN__
       /* Temporary fix.  Use '@' instead of '?' here for Windows. */
@@ -1319,7 +1361,7 @@
 
       /* Copy QUERY to RESULT and encode all '/' characters. */
       from = query;
-      while (*from && to - result < sizeof (result))
+      while (*from && to - result < max_size)
 	{
 	  if (*from == '/')
 	    {
@@ -1333,12 +1375,7 @@
 	}
     }
 
-  if (to - result < sizeof (result))
-    *to = '\0';
-  else
-    /* Truncate input which is too long, presumably due to a huge
-       query string.  */
-    result[sizeof (result) - 1] = '\0';
+  *to = '\0';
 
   return xstrdup (result);
 }
@@ -1793,6 +1830,8 @@
   char *scheme_str = supported_schemes[url->scheme].leading_string;
   int fplen = full_path_length (url);
 
+  int brackets_around_host = 0;
+
   assert (scheme_str != NULL);
 
   /* Make sure the user name and password are quoted. */
@@ -1808,8 +1847,12 @@
 	}
     }
 
+  if (strchr (url->host, ':'))
+    brackets_around_host = 1;
+
   size = (strlen (scheme_str)
 	  + strlen (url->host)
+	  + (brackets_around_host ? 2 : 0)
 	  + fplen
 	  + 1);
   if (url->port != scheme_port)
@@ -1835,7 +1878,11 @@
       *p++ = '@';
     }
 
+  if (brackets_around_host)
+    *p++ = '[';
   APPEND (p, url->host);
+  if (brackets_around_host)
+    *p++ = ']';
   if (url->port != scheme_port)
     {
       *p++ = ':';
--- wget-1.8.2.orig/src/utils.c
+++ wget-1.8.2/src/utils.c
@@ -1280,7 +1280,7 @@
 
 /* Count the digits in a (long) integer.  */
 int
-numdigit (long number)
+numdigit (long long number)
 {
   int cnt = 1;
   if (number < 0)
--- wget-1.8.2.orig/src/utils.h
+++ wget-1.8.2/src/utils.h
@@ -99,7 +99,7 @@
 
 char *legible PARAMS ((long));
 char *legible_very_long PARAMS ((VERY_LONG_TYPE));
-int numdigit PARAMS ((long));
+int numdigit PARAMS ((long long));
 char *number_to_string PARAMS ((char *, long));
 
 struct wget_timer *wtimer_allocate PARAMS ((void));
--- wget-1.8.2.orig/config.guess
+++ wget-1.8.2/config.guess
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-#   Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2001-09-04'
+timestamp='2002-09-03'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,8 +24,9 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Written by Per Bothner <bothner@cygnus.com>.
-# Please send patches to <config-patches@gnu.org>.
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # This script attempts to guess a canonical system name similar to
 # config.sub.  If it succeeds, it prints the system name on stdout, and
@@ -87,30 +88,40 @@
   exit 1
 fi
 
+trap 'exit 1' 1 2 15
 
-dummy=dummy-$$
-trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
 
-# CC_FOR_BUILD -- compiler used by this script.
 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
 # use `HOST_CC' if defined, but it is deprecated.
 
-set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int dummy(){}" > $dummy.c ;
-	for c in cc gcc c89 ; do
-	  ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ;
-	  if test $? = 0 ; then
+# This shell variable is my proudest work .. or something. --bje
+
+set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+dummy=$tmpdir/dummy ;
+files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then
 	     CC_FOR_BUILD="$c"; break ;
 	  fi ;
 	done ;
-	rm -f $dummy.c $dummy.o $dummy.rel ;
+	rm -f $files ;
 	if test x"$CC_FOR_BUILD" = x ; then
 	  CC_FOR_BUILD=no_compiler_found ;
 	fi
 	;;
  ,,*)   CC_FOR_BUILD=$CC ;;
  ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac'
+esac ;
+unset files'
 
 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
 # (ghazi@noc.rutgers.edu 1994-08-24)
@@ -127,29 +138,30 @@
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:NetBSD:*:*)
-	# Netbsd (nbsd) targets should (where applicable) match one or
+	# NetBSD (nbsd) targets should (where applicable) match one or
 	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
 	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
 	# switched to ELF, *-*-netbsd* would select the old
 	# object file format.  This provides both forward
 	# compatibility and a consistent mechanism for selecting the
 	# object file format.
-	# Determine the machine/vendor (is the vendor relevant).
-	case "${UNAME_MACHINE}" in
-	    amiga) machine=m68k-unknown ;;
-	    arm32) machine=arm-unknown ;;
-	    atari*) machine=m68k-atari ;;
-	    sun3*) machine=m68k-sun ;;
-	    mac68k) machine=m68k-apple ;;
-	    macppc) machine=powerpc-apple ;;
-	    hp3[0-9][05]) machine=m68k-hp ;;
-	    ibmrt|romp-ibm) machine=romp-ibm ;;
-	    *) machine=${UNAME_MACHINE}-unknown ;;
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently, or will in the future.
-	case "${UNAME_MACHINE}" in
-	    i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k)
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep __ELF__ >/dev/null
@@ -172,6 +184,45 @@
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
 	echo "${machine}-${os}${release}"
 	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
     alpha:OSF1:*:*)
 	if test $UNAME_RELEASE = "V4.0"; then
 		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -180,6 +231,7 @@
 	# A Tn.n version is a released field test version.
 	# A Xn.n version is an unreleased experimental baselevel.
 	# 1.2 uses "1.2" for uname -r.
+	eval $set_cc_for_build
 	cat <<EOF >$dummy.s
 	.data
 \$Lformat:
@@ -205,10 +257,9 @@
 	jsr \$26,exit
 	.end main
 EOF
-	eval $set_cc_for_build
 	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
 	if test "$?" = 0 ; then
-		case `./$dummy` in
+		case `$dummy` in
 			0-0)
 				UNAME_MACHINE="alpha"
 				;;
@@ -230,9 +281,12 @@
 			2-1307)
 				UNAME_MACHINE="alphaev68"
 				;;
+			3-1307)
+				UNAME_MACHINE="alphaev7"
+				;;
 		esac
 	fi
-	rm -f $dummy.s $dummy
+	rm -f $dummy.s $dummy && rmdir $tmpdir
 	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
 	exit 0 ;;
     Alpha\ *:Windows_NT*:*)
@@ -247,29 +301,11 @@
     Amiga*:UNIX_System_V:4.0:*)
 	echo m68k-unknown-sysv4
 	exit 0;;
-    amiga:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     *:[Aa]miga[Oo][Ss]:*:*)
 	echo ${UNAME_MACHINE}-unknown-amigaos
 	exit 0 ;;
-    arc64:OpenBSD:*:*)
-	echo mips64el-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    arc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    hkmips:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    pmax:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    sgi:OpenBSD:*:*)
-	echo mips-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    wgrisc:OpenBSD:*:*)
-	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
 	exit 0 ;;
     *:OS/390:*:*)
 	echo i370-ibm-openedition
@@ -291,6 +327,10 @@
     NILE*:*:*:dcosx)
 	echo pyramid-pyramid-svr4
 	exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+	esac ;;
     sun4H:SunOS:5.*:*)
 	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
 	exit 0 ;;
@@ -319,7 +359,7 @@
 	echo m68k-sun-sunos${UNAME_RELEASE}
 	exit 0 ;;
     sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
 	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
 	case "`/bin/arch`" in
 	    sun3)
@@ -333,12 +373,6 @@
     aushp:SunOS:*:*)
 	echo sparc-auspex-sunos${UNAME_RELEASE}
 	exit 0 ;;
-    sparc*:NetBSD:*)
-	echo `uname -p`-unknown-netbsd${UNAME_RELEASE}
-	exit 0 ;;
-    atari*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     # The situation for MiNT is a little confusing.  The machine name
     # can be virtually everything (everything which is not
     # "atarist" or "atariste" at least should have a processor
@@ -365,18 +399,6 @@
     *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
         echo m68k-unknown-mint${UNAME_RELEASE}
         exit 0 ;;
-    sun3*:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mac68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme68k:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
-    mvme88k:OpenBSD:*:*)
-	echo m88k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     powerpc:machten:*:*)
 	echo powerpc-apple-machten${UNAME_RELEASE}
 	exit 0 ;;
@@ -416,14 +438,20 @@
 	}
 EOF
 	$CC_FOR_BUILD $dummy.c -o $dummy \
-	  && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
-	  && rm -f $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
+	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
 	echo mips-mips-riscos${UNAME_RELEASE}
 	exit 0 ;;
     Motorola:PowerMAX_OS:*:*)
 	echo powerpc-motorola-powermax
 	exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS)
+	echo powerpc-harris-powermax
+	exit 0 ;;
     Night_Hawk:Power_UNIX:*:*)
 	echo powerpc-harris-powerunix
 	exit 0 ;;
@@ -496,8 +524,8 @@
 			exit(0);
 			}
 EOF
-		$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
-		rm -f $dummy.c $dummy
+		$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+		rm -f $dummy.c $dummy && rmdir $tmpdir
 		echo rs6000-ibm-aix3.2.5
 	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
 		echo rs6000-ibm-aix3.2.4
@@ -506,7 +534,7 @@
 	fi
 	exit 0 ;;
     *:AIX:*:[45])
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
 	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
 		IBM_ARCH=rs6000
 	else
@@ -546,10 +574,8 @@
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
 	    9000/[678][0-9][0-9])
-              case "${HPUX_REV}" in
-                11.[0-9][0-9])
-                  if [ -x /usr/bin/getconf ]; then
-                    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
                     sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
                     case "${sc_cpu_version}" in
                       523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
@@ -558,13 +584,13 @@
                         case "${sc_kernel_bits}" in
                           32) HP_ARCH="hppa2.0n" ;;
                           64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
                         esac ;;
                     esac
-                  fi ;;
-              esac
-              if [ "${HP_ARCH}" = "" ]; then
-	      eval $set_cc_for_build
-              sed 's/^              //' << EOF >$dummy.c
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
 
               #define _HPUX_SOURCE
               #include <stdlib.h>
@@ -597,10 +623,10 @@
                   exit (0);
               }
 EOF
-	    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
-	    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
-	    rm -f $dummy.c $dummy
-	fi ;;
+		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy`
+		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+		    rm -f $dummy.c $dummy && rmdir $tmpdir
+		fi ;;
 	esac
 	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
 	exit 0 ;;
@@ -635,8 +661,8 @@
 	  exit (0);
 	}
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
+	$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
 	echo unknown-hitachi-hiuxwe2
 	exit 0 ;;
     9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
@@ -664,9 +690,6 @@
     parisc*:Lites*:*:*)
 	echo hppa1.1-hp-lites
 	exit 0 ;;
-    hppa*:OpenBSD:*:*)
-	echo hppa-unknown-openbsd
-	exit 0 ;;
     C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
 	echo c1-convex-bsd
         exit 0 ;;
@@ -685,9 +708,6 @@
     C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
 	echo c4-convex-bsd
         exit 0 ;;
-    CRAY*X-MP:*:*:*)
-	echo xmp-cray-unicos
-        exit 0 ;;
     CRAY*Y-MP:*:*:*)
 	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
@@ -709,18 +729,12 @@
     CRAY*SV1:*:*:*)
 	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
 	exit 0 ;;
-    CRAY-2:*:*:*)
-	echo cray2-cray-unicos
-        exit 0 ;;
     F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
 	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
         FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
         FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
         echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
         exit 0 ;;
-    hp300:OpenBSD:*:*)
-	echo m68k-unknown-openbsd${UNAME_RELEASE}
-	exit 0 ;;
     i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
 	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
 	exit 0 ;;
@@ -731,10 +745,19 @@
 	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
 	exit 0 ;;
     *:FreeBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit 0 ;;
-    *:OpenBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	# Determine whether the default compiler uses glibc.
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#if __GLIBC__ >= 2
+	LIBC=gnu
+	#else
+	LIBC=
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
 	exit 0 ;;
     i*:CYGWIN*:*)
 	echo ${UNAME_MACHINE}-pc-cygwin
@@ -745,6 +768,9 @@
     i*:PW*:*)
 	echo ${UNAME_MACHINE}-pc-pw32
 	exit 0 ;;
+    x86:Interix*:3*)
+	echo i386-pc-interix3
+	exit 0 ;;
     i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
 	# How do we know it's Interix rather than the generic POSIX subsystem?
 	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -770,16 +796,30 @@
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
     m68*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
     mips:Linux:*:*)
-	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
-	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
-	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
-	esac
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
 	;;
     ppc:Linux:*:*)
 	echo powerpc-unknown-linux-gnu
@@ -828,7 +868,8 @@
 	# The BFD linker knows what the default object file format is, so
 	# first see if it will tell us. cd to the root directory to prevent
 	# problems with other programs or directories called `ld' in the path.
-	ld_supported_targets=`cd /; ld --help 2>&1 \
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
 			 | sed -ne '/supported targets:/!d
 				    s/[ 	][ 	]*/ /g
 				    s/.*supported targets: *//
@@ -840,7 +881,7 @@
 		;;
 	  a.out-i386-linux)
 		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit 0 ;;		
+		exit 0 ;;
 	  coff-i386)
 		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
 		exit 0 ;;
@@ -852,32 +893,29 @@
 	esac
 	# Determine whether the default compiler is a.out or elf
 	eval $set_cc_for_build
-	cat >$dummy.c <<EOF
-#include <features.h>
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-#ifdef __ELF__
-# ifdef __GLIBC__
-#  if __GLIBC__ >= 2
-    printf ("%s-pc-linux-gnu\n", argv[1]);
-#  else
-    printf ("%s-pc-linux-gnulibc1\n", argv[1]);
-#  endif
-# else
-   printf ("%s-pc-linux-gnulibc1\n", argv[1]);
-# endif
-#else
-  printf ("%s-pc-linux-gnuaout\n", argv[1]);
-#endif
-  return 0;
-}
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
 EOF
-	$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0
-	rm -f $dummy.c $dummy
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
 	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
 	;;
     i*86:DYNIX/ptx:4*:*)
@@ -915,13 +953,13 @@
 		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
 		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
 	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
-		(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
 			&& UNAME_MACHINE=i586
-		(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
 			&& UNAME_MACHINE=i686
-		(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
 			&& UNAME_MACHINE=i686
 		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
 	else
@@ -954,9 +992,12 @@
 	# "miniframe"
 	echo m68010-convergent-sysv
 	exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit 0 ;;
     M68*:*:R3V[567]*:*)
 	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
-    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
 	OS_REL=''
 	test -r /etc/.relid \
 	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
@@ -1047,6 +1088,9 @@
     SX-5:SUPER-UX:*:*)
 	echo sx5-nec-superux${UNAME_RELEASE}
 	exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
     Power*:Rhapsody:*:*)
 	echo powerpc-apple-rhapsody${UNAME_RELEASE}
 	exit 0 ;;
@@ -1057,15 +1101,17 @@
 	echo `uname -p`-apple-darwin${UNAME_RELEASE}
 	exit 0 ;;
     *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	if test "${UNAME_MACHINE}" = "x86pc"; then
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
 		UNAME_MACHINE=pc
 	fi
-	echo `uname -p`-${UNAME_MACHINE}-nto-qnx
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
 	exit 0 ;;
     *:QNX:*:4*)
 	echo i386-pc-qnx
 	exit 0 ;;
-    NSR-[KW]:NONSTOP_KERNEL:*:*)
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
 	echo nsr-tandem-nsk${UNAME_RELEASE}
 	exit 0 ;;
     *:NonStop-UX:*:*)
@@ -1237,8 +1283,8 @@
 }
 EOF
 
-$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0
-rm -f $dummy.c $dummy
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+rm -f $dummy.c $dummy && rmdir $tmpdir
 
 # Apollos put the system type in the environment.
 
--- wget-1.8.2.orig/config.sub
+++ wget-1.8.2/config.sub
@@ -1,9 +1,9 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
-#   Free Software Foundation, Inc.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
 
-timestamp='2001-09-07'
+timestamp='2002-09-05'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -29,7 +29,8 @@
 # configuration script generated by Autoconf, you may include it under
 # the same distribution terms that you use for the rest of that program.
 
-# Please send patches to <config-patches@gnu.org>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -117,7 +118,7 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*)
+  nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -226,32 +227,42 @@
 	1750a | 580 \
 	| a29k \
 	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
 	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-	| c4x | clipper \
-	| d10v | d30v | dsp16xx \
-	| fr30 \
+	| clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| i370 | i860 | i960 | ia64 \
+	| ip2k \
 	| m32r | m68000 | m68k | m88k | mcore \
-	| mips16 | mips64 | mips64el | mips64orion | mips64orionel \
-	| mips64vr4100 | mips64vr4100el | mips64vr4300 \
-	| mips64vr4300el | mips64vr5000 | mips64vr5000el \
-	| mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \
-	| mipsisa32 \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
 	| mn10200 | mn10300 \
 	| ns16k | ns32k \
-	| openrisc \
+	| openrisc | or32 \
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| s390 | s390x \
-	| sh | sh[34] | sh[34]eb | shbe | shle \
-	| sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \
-	| stormy16 | strongarm \
+	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+	| strongarm \
 	| tahoe | thumb | tic80 | tron \
-	| v850 \
+	| v850 | v850e \
 	| we32k \
-	| x86 | xscale \
+	| x86 | xscale | xstormy16 | xtensa \
 	| z8k)
 		basic_machine=$basic_machine-unknown
 		;;
@@ -278,38 +289,51 @@
 	580-* \
 	| a29k-* \
 	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-	| alphapca5[67]-* | arc-* \
-	| arm-*  | armbe-* | armle-* | armv*-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
 	| bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c54x-* \
-	| clipper-* | cray2-* | cydra-* \
-	| d10v-* | d30v-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+	| clipper-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
 	| elxsi-* \
-	| f30[01]-* | f700-* | fr30-* | fx80-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
 	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* \
 	| m32r-* \
-	| m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
 	| m88110-* | m88k-* | mcore-* \
-	| mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \
-	| mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \
-	| mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \
-	| mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39 | mipstx39el \
 	| none-* | np1-* | ns16k-* | ns32k-* \
 	| orion-* \
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| s390-* | s390x-* \
-	| sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \
-	| sparc-* | sparc64-* | sparc86x-* | sparclite-* \
-	| sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \
-	| t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \
-	| v850-* | vax-* \
+	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+	| v850-* | v850e-* | vax-* \
 	| we32k-* \
-	| x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
 	| ymp-* \
 	| z8k-*)
 		;;
@@ -374,6 +398,10 @@
 		basic_machine=ns32k-sequent
 		os=-dynix
 		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
 	convex-c1)
 		basic_machine=c1-convex
 		os=-bsd
@@ -394,16 +422,8 @@
 		basic_machine=c38-convex
 		os=-bsd
 		;;
-	cray | ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	cray2)
-		basic_machine=cray2-cray
-		os=-unicos
-		;;
-	[cjt]90)
-		basic_machine=${basic_machine}-cray
+	cray | j90)
+		basic_machine=j90-cray
 		os=-unicos
 		;;
 	crds | unos)
@@ -418,6 +438,14 @@
 	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
 		basic_machine=mips-dec
 		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
 	delta | 3300 | motorola-3300 | motorola-delta \
 	      | 3300-motorola | delta-motorola)
 		basic_machine=m68k-motorola
@@ -598,14 +626,6 @@
 		basic_machine=m68k-atari
 		os=-mint
 		;;
-	mipsel*-linux*)
-		basic_machine=mipsel-unknown
-		os=-linux-gnu
-		;;
-	mips*-linux*)
-		basic_machine=mips-unknown
-		os=-linux-gnu
-		;;
 	mips3*-*)
 		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
 		;;
@@ -620,6 +640,10 @@
 		basic_machine=m68k-rom68k
 		os=-coff
 		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
 	msdos)
 		basic_machine=i386-pc
 		os=-msdos
@@ -699,6 +723,10 @@
 		basic_machine=hppa1.1-oki
 		os=-proelf
 		;;
+	or32 | or32-*)
+		basic_machine=or32-unknown
+		os=-coff
+		;;
 	OSE68000 | ose68000)
 		basic_machine=m68000-ericsson
 		os=-ose
@@ -721,19 +749,19 @@
 	pbb)
 		basic_machine=m68k-tti
 		;;
-        pc532 | pc532-*)
+	pc532 | pc532-*)
 		basic_machine=ns32k-pc532
 		;;
-	pentium | p5 | k5 | k6 | nexgen)
+	pentium | p5 | k5 | k6 | nexgen | viac3)
 		basic_machine=i586-pc
 		;;
-	pentiumpro | p6 | 6x86 | athlon)
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
 		basic_machine=i686-pc
 		;;
 	pentiumii | pentium2)
 		basic_machine=i686-pc
 		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-*)
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
 		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	pentiumpro-* | p6-* | 6x86-* | athlon-*)
@@ -748,22 +776,22 @@
 	power)	basic_machine=power-ibm
 		;;
 	ppc)	basic_machine=powerpc-unknown
-	        ;;
+		;;
 	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppcle | powerpclittle | ppc-le | powerpc-little)
 		basic_machine=powerpcle-unknown
-	        ;;
+		;;
 	ppcle-* | powerpclittle-*)
 		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppc64)	basic_machine=powerpc64-unknown
-	        ;;
+		;;
 	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
 	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
 		basic_machine=powerpc64le-unknown
-	        ;;
+		;;
 	ppc64le-* | powerpc64little-*)
 		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
 		;;
@@ -784,10 +812,22 @@
 	rtpc | rtpc-*)
 		basic_machine=romp-ibm
 		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
 	sa29200)
 		basic_machine=a29k-amd
 		os=-udi
 		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
 	sequent)
 		basic_machine=i386-sequent
 		;;
@@ -795,7 +835,7 @@
 		basic_machine=sh-hitachi
 		os=-hms
 		;;
-	sparclite-wrs)
+	sparclite-wrs | simso-wrs)
 		basic_machine=sparclite-wrs
 		os=-vxworks
 		;;
@@ -861,10 +901,22 @@
 		basic_machine=i386-sequent
 		os=-dynix
 		;;
+	t3d)
+		basic_machine=alpha-cray
+		os=-unicos
+		;;
 	t3e)
-		basic_machine=t3e-cray
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
 		os=-unicos
 		;;
+        tic4x | c4x*)
+		basic_machine=tic4x-unknown
+		os=-coff
+		;;
 	tic54x | c54x*)
 		basic_machine=tic54x-unknown
 		os=-coff
@@ -875,6 +927,10 @@
 	tx39el)
 		basic_machine=mipstx39el-unknown
 		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
 	tower | tower-32)
 		basic_machine=m68k-ncr
 		;;
@@ -899,8 +955,8 @@
 		os=-vms
 		;;
 	vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
+		basic_machine=f301-fujitsu
+		;;
 	vxworks960)
 		basic_machine=i960-wrs
 		os=-vxworks
@@ -925,13 +981,13 @@
 		basic_machine=i386-pc
 		os=-windows32-msvcrt
 		;;
-	xmp)
-		basic_machine=xmp-cray
-		os=-unicos
-		;;
-        xps | xps100)
+	xps | xps100)
 		basic_machine=xps100-honeywell
 		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
 	z8k-*-coff)
 		basic_machine=z8k-unknown
 		os=-sim
@@ -952,13 +1008,6 @@
 	op60c)
 		basic_machine=hppa1.1-oki
 		;;
-	mips)
-		if [ x$os = x-linux-gnu ]; then
-			basic_machine=mips-unknown
-		else
-			basic_machine=mips-mips
-		fi
-		;;
 	romp)
 		basic_machine=romp-ibm
 		;;
@@ -978,13 +1027,16 @@
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh3 | sh4 | sh3eb | sh4eb)
+	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
 		basic_machine=sh-unknown
 		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
 	sparc | sparcv9 | sparcv9b)
 		basic_machine=sparc-sun
 		;;
-        cydra)
+	cydra)
 		basic_machine=cydra-cydrome
 		;;
 	orion)
@@ -999,10 +1051,6 @@
 	pmac | pmac-mpw)
 		basic_machine=powerpc-apple
 		;;
-	c4x*)
-		basic_machine=c4x-none
-		os=-coff
-		;;
 	*-unknown)
 		# Make sure to match an already-canonicalized machine name.
 		;;
@@ -1068,7 +1116,8 @@
 	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
 	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
 	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-	      | -os2* | -vos*)
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
 	-qnx*)
@@ -1120,14 +1169,20 @@
 	-acis*)
 		os=-aos
 		;;
+	-atheos*)
+		os=-atheos
+		;;
 	-386bsd)
 		os=-bsd
 		;;
 	-ctix* | -uts*)
 		os=-sysv
 		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
 	-ns2 )
-	        os=-nextstep2
+		os=-nextstep2
 		;;
 	-nsk*)
 		os=-nsk
@@ -1166,8 +1221,8 @@
 	-xenix)
 		os=-xenix
 		;;
-        -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-	        os=-mint
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
 		;;
 	-none)
 		;;
@@ -1200,10 +1255,11 @@
 	arm*-semi)
 		os=-aout
 		;;
+	# This must come before the *-dec entry.
 	pdp10-*)
 		os=-tops20
 		;;
-        pdp11-*)
+	pdp11-*)
 		os=-none
 		;;
 	*-dec | vax-*)
@@ -1230,6 +1286,9 @@
 	mips*-*)
 		os=-elf
 		;;
+	or32-*)
+		os=-coff
+		;;
 	*-tti)	# must be before sparc entry or we get the wrong os.
 		os=-sysv3
 		;;
@@ -1293,19 +1352,19 @@
 	*-next)
 		os=-nextstep3
 		;;
-        *-gould)
+	*-gould)
 		os=-sysv
 		;;
-        *-highlevel)
+	*-highlevel)
 		os=-bsd
 		;;
 	*-encore)
 		os=-bsd
 		;;
-        *-sgi)
+	*-sgi)
 		os=-irix
 		;;
-        *-siemens)
+	*-siemens)
 		os=-sysv4
 		;;
 	*-masscomp)
@@ -1377,7 +1436,7 @@
 			-ptx*)
 				vendor=sequent
 				;;
-			-vxsim* | -vxworks*)
+			-vxsim* | -vxworks* | -windiss*)
 				vendor=wrs
 				;;
 			-aux*)
--- wget-1.8.2.orig/configure
+++ wget-1.8.2/configure
@@ -8013,6 +8013,8 @@
   COMMENT_IF_NO_POD2MAN=
 fi
 
+echo enable IPv6 1>&6
+CFLAGS="$CFLAGS -DINET6 "
 
 trap '' 1 2 15
 cat > confcache <<\EOF
--- wget-1.8.2.orig/libtool
+++ wget-1.8.2/libtool
@@ -35,7 +35,7 @@
 
 # ### BEGIN LIBTOOL CONFIG
 
-# Libtool was configured on host florida.munich.redhat.com:
+# Libtool was configured on host p4:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"