]> git.cameronkatri.com Git - bsd-progress.git/blobdiff - progressbar.c
Don't try to determining the size of what's coming when reading from a pipe.
[bsd-progress.git] / progressbar.c
index e9b63663b2770560919d8d3f8064cbc690f18590..43b185187c9248939739ac6ae2a8bfe70c41b712 100644 (file)
@@ -1,7 +1,7 @@
-/*     $NetBSD: progressbar.c,v 1.9 2005/05/20 07:26:01 he Exp $       */
+/*     $NetBSD: progressbar.c,v 1.11 2005/07/19 00:41:05 lukem Exp $   */
 
 /*-
- * Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: progressbar.c,v 1.9 2005/05/20 07:26:01 he Exp $");
+__RCSID("$NetBSD: progressbar.c,v 1.11 2005/07/19 00:41:05 lukem Exp $");
 #endif /* not lint */
 
 /*
@@ -121,8 +121,7 @@ progressmeter(int flag)
        struct timeval td;
        off_t abbrevsize, bytespersec;
        double elapsed;
-       int ratio, i, remaining;
-       size_t barlength;
+       int ratio, i, remaining, barlength;
 
                        /*
                         * Work variables for progress bar.
@@ -216,7 +215,7 @@ progressmeter(int flag)
                         */
                barlength = MIN(sizeof(buf) - 1, ttywidth) - BAROVERHEAD;
                if (prefix)
-                       barlength -= strlen(prefix);
+                       barlength -= (int)strlen(prefix);
                if (barlength > 0) {
                        i = barlength * ratio / 100;
                        len += snprintf(buf + len, BUFLEFT,