aboutsummaryrefslogtreecommitdiffstats
path: root/progressbar.c
diff options
context:
space:
mode:
Diffstat (limited to 'progressbar.c')
-rw-r--r--progressbar.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/progressbar.c b/progressbar.c
index f096ffc..9c09147 100644
--- a/progressbar.c
+++ b/progressbar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: progressbar.c,v 1.4 2003/07/17 12:06:18 lukem Exp $ */
+/* $NetBSD: progressbar.c,v 1.5 2004/03/09 17:04:24 hubertf Exp $ */
/*-
* Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: progressbar.c,v 1.4 2003/07/17 12:06:18 lukem Exp $");
+__RCSID("$NetBSD: progressbar.c,v 1.5 2004/03/09 17:04:24 hubertf Exp $");
#endif /* not lint */
/*
@@ -52,6 +52,7 @@ __RCSID("$NetBSD: progressbar.c,v 1.4 2003/07/17 12:06:18 lukem Exp $");
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include <tzfile.h>
#include <unistd.h>
@@ -200,6 +201,8 @@ progressmeter(int flag)
return;
len += snprintf(buf + len, BUFLEFT, "\r");
+ if (prefix)
+ len += snprintf(buf + len, BUFLEFT, "%s", prefix);
if (filesize > 0) {
ratio = (int)((double)cursize * 100.0 / (double)filesize);
ratio = MAX(ratio, 0);
@@ -211,6 +214,8 @@ progressmeter(int flag)
* the number of stars won't exceed the buffer size
*/
barlength = MIN(sizeof(buf) - 1, ttywidth) - BAROVERHEAD;
+ if (prefix)
+ barlength -= strlen(prefix);
if (barlength > 0) {
i = barlength * ratio / 100;
len += snprintf(buf + len, BUFLEFT,