From 6ba7711d6a0ff39ea5cacccb1c9ab7b087acfd2e Mon Sep 17 00:00:00 2001
From: hniksic <devnull@localhost>
Date: Mon, 23 Apr 2001 08:28:34 -0700
Subject: [PATCH] [svn] Print download rate even when percentages are not
 available. Published in <sxs1yqjd4ct.fsf@florida.arsdigita.de>.

---
 src/ChangeLog |  5 +++++
 src/retr.c    | 46 +++++++++++++++++++++-------------------------
 2 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 082e3557..a79a290b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2001-04-23  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+	* retr.c (show_progress): Print the download rate even when the
+	percentages are not available.
+
 2001-04-21  Hrvoje Niksic  <hniksic@arsdigita.com>
 
 	* ftp.c (getftp): Adjust expected_bytes if the length is
diff --git a/src/retr.c b/src/retr.c
index 3aae5125..1667f52e 100644
--- a/src/retr.c
+++ b/src/retr.c
@@ -183,27 +183,25 @@ show_progress (long res, long expected, enum spflags flags)
 
   if (flags == SP_FINISH)
     {
-      if (expected)
+      int dot = ndot;
+      char *tmpstr = (char *)alloca (2 * opt.dots_in_line + 1);
+      char *tmpp = tmpstr;
+      time_offset = elapsed_time () - last_timer;
+      for (; dot < opt.dots_in_line; dot++)
 	{
-	  int dot = ndot;
-	  char *tmpstr = (char *)alloca (2 * opt.dots_in_line + 1);
-	  char *tmpp = tmpstr;
-	  time_offset = elapsed_time () - last_timer;
-	  for (; dot < opt.dots_in_line; dot++)
-	    {
-	      if (!(dot % opt.dot_spacing))
-		*tmpp++ = ' ';
-	      *tmpp++ = ' ';
-	    }
-	  *tmpp = '\0';
-	  logputs (LOG_VERBOSE, tmpstr);
-	  print_percentage (nrow * line_bytes + ndot * opt.dot_bytes + offs,
-			    expected);
-	  logprintf (LOG_VERBOSE, " @%s",
-		     rate (ndot * opt.dot_bytes
-			   + offs - (initial_skip % line_bytes),
-			   time_offset, 1));
+	  if (!(dot % opt.dot_spacing))
+	    *tmpp++ = ' ';
+	  *tmpp++ = ' ';
 	}
+      *tmpp = '\0';
+      logputs (LOG_VERBOSE, tmpstr);
+      if (expected)
+	print_percentage (nrow * line_bytes + ndot * opt.dot_bytes + offs,
+			  expected);
+      logprintf (LOG_VERBOSE, " @%s",
+		 rate (ndot * opt.dot_bytes
+		       + offs - (initial_skip % line_bytes),
+		       time_offset, 1));
       logputs (LOG_VERBOSE, "\n\n");
       return 0;
     }
@@ -255,12 +253,10 @@ show_progress (long res, long expected, enum spflags flags)
 	  ndot = 0;
 	  ++nrow;
 	  if (expected)
-	    {
-	      print_percentage (nrow * line_bytes, expected);
-	      logprintf (LOG_VERBOSE, " @%s",
-			 rate (line_bytes - (initial_skip % line_bytes),
-			       time_offset, 1));
-	    }
+	    print_percentage (nrow * line_bytes, expected);
+	  logprintf (LOG_VERBOSE, " @%s",
+		     rate (line_bytes - (initial_skip % line_bytes),
+			   time_offset, 1));
 	  initial_skip = 0;
 	  logprintf (LOG_VERBOSE, "\n%5ldK", nrow * line_bytes / 1024);
 	}