Fix division by zero bug in download summary

Hrvoje Niksic <[email protected]> Sat, 17 Sep 2005 15:06:46 +0200
Newsgroups gmane.comp.web.wget.patches
Message-ID <[email protected]>
In devel. Wget a "nan" value is printed for download speed if nothing
has been downloaded (due to, e.g. all files having returned 404).
This fixes the problem.

2005-09-17  Hrvoje Niksic  <[email protected]>

	* main.c (main): Don't print the summary if nothing has been downloaded.

Index: main.c
===================================================================
--- main.c	(revision 2065)
+++ main.c	(working copy)
@@ -968,9 +968,11 @@
 		   opt.input_filename);
     }
   /* Print the downloaded sum.  */
-  if (opt.recursive || opt.page_requisites
-      || nurl > 1
-      || (opt.input_filename && total_downloaded_bytes != 0))
+  if ((opt.recursive || opt.page_requisites
+       || nurl > 1
+       || (opt.input_filename && total_downloaded_bytes != 0))
+      &&
+      total_downloaded_bytes != 0)
     {
       logprintf (LOG_NOTQUIET,
 		 _("FINISHED --%s--\nDownloaded: %d files, %s in %s (%s)\n"),