diff options
Diffstat (limited to 'contrib/lukemftp/src/progressbar.c')
-rw-r--r-- | contrib/lukemftp/src/progressbar.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/lukemftp/src/progressbar.c b/contrib/lukemftp/src/progressbar.c index 7ae2f7d79844..48332a62c357 100644 --- a/contrib/lukemftp/src/progressbar.c +++ b/contrib/lukemftp/src/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 */ /* @@ -53,6 +53,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 <unistd.h> @@ -203,6 +204,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); @@ -214,6 +217,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, |