]> sjero.net Git - wget/blobdiff - src/progress.c
[svn] Update FSF's address and copyright years.
[wget] / src / progress.c
index a8e9d78da69c655b8d8801b11b5c0c50d74d2e74..b913749cb872f202d1fa98f0b896222a46bb9afc 100644 (file)
@@ -1,5 +1,5 @@
 /* Download progress.
-   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2001-2005 Free Software Foundation, Inc.
 
 This file is part of GNU Wget.
 
@@ -14,8 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with Wget; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+along with Wget; if not, write to the Free Software Foundation, Inc.,
+51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 
 In addition, as a special exception, the Free Software Foundation
 gives permission to link the code of its release of Wget with the
@@ -301,12 +301,12 @@ print_row_stats (struct dot_progress *dp, double dltime, bool last)
     else
       /* For last row also include bytes accumulated after last dot.  */
       bytes_this_row = dp->dots * opt.dot_bytes + dp->accumulated;
+    /* Don't count the portion of the row belonging to initial_length */
     if (dp->rows == dp->initial_length / ROW_BYTES)
-      /* Don't count the portion of the row belonging to initial_length */
       bytes_this_row -= dp->initial_length % ROW_BYTES;
     rate = calc_rate (bytes_this_row, dltime - dp->last_timer_value, &units);
     logprintf (LOG_VERBOSE, " %4.*f%c",
-              rate >= 100 ? 0 : rate >= 9.995 ? 1 : 2,
+              rate >= 99.95 ? 0 : rate >= 9.995 ? 1 : 2,
               rate, names[units]);
     dp->last_timer_value = dltime;
   }
@@ -362,10 +362,6 @@ dot_update (void *progress, wgint howmuch, double dltime)
       ++dp->dots;
       if (dp->dots >= opt.dots_in_line)
        {
-         wgint row_qty = ROW_BYTES;
-         if (dp->rows == dp->initial_length / ROW_BYTES)
-           row_qty -= dp->initial_length % ROW_BYTES;
-
          ++dp->rows;
          dp->dots = 0;
 
@@ -791,13 +787,13 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
      "xx% " or "100%"  - percentage               - 4 chars
      "[]"              - progress bar decorations - 2 chars
      " nnn,nnn,nnn"    - downloaded bytes         - 12 chars or very rarely more
-     " 1012.56K/s"     - dl rate                  - 11 chars
+     " 12.5K/s"        - download rate             - 8 chars
      "  eta 36m 51s"   - ETA                      - 13 chars
 
      "=====>..."       - progress bar             - the rest
   */
   int dlbytes_size = 1 + MAX (size_grouped_len, 11);
-  int progress_size = bp->width - (4 + 2 + dlbytes_size + 11 + 13);
+  int progress_size = bp->width - (4 + 2 + dlbytes_size + 8 + 13);
 
   if (progress_size < 5)
     progress_size = 0;
@@ -882,7 +878,7 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
   sprintf (p, " %-11s", size_grouped);
   move_to_end (p);
 
-  /* " 1012.45K/s" */
+  /* " 12.52K/s" */
   if (hist->total_time && hist->total_bytes)
     {
       static const char *short_units[] = { "B/s", "K/s", "M/s", "G/s" };
@@ -892,11 +888,12 @@ create_image (struct bar_progress *bp, double dl_total_time, bool done)
       wgint dlquant = hist->total_bytes + bp->recent_bytes;
       double dltime = hist->total_time + (dl_total_time - bp->recent_start);
       double dlspeed = calc_rate (dlquant, dltime, &units);
-      sprintf (p, " %7.2f%s", dlspeed, short_units[units]);
+      sprintf (p, " %4.*f%s", dlspeed >= 99.95 ? 0 : dlspeed >= 9.995 ? 1 : 2,
+              dlspeed, short_units[units]);
       move_to_end (p);
     }
   else
-    APPEND_LITERAL ("   --.--K/s");
+    APPEND_LITERAL (" --.-K/s");
 
   if (!done)
     {