diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-12-29 01:11:14 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-12-29 01:11:14 +0000 |
commit | b1e35f4f5d8eeefbbf798f7e78173433e3925196 (patch) | |
tree | 7515163d433c0ae23ccd1ebab7c5a0ce7ace6d00 | |
parent | 74d2bdeb72085f96dcefb756e52aee93b2cafee0 (diff) |
round number of stars immediately, avoids off-by-1 display error.
fixes an elusive problem reported ages ago by sturm@...
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm index 863add6e2a5..b98d4e2021f 100644 --- a/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm +++ b/usr.sbin/pkg_add/OpenBSD/ProgressMeter.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: ProgressMeter.pm,v 1.3 2004/11/14 11:58:43 espie Exp $ +# $OpenBSD: ProgressMeter.pm,v 1.4 2004/12/29 01:11:13 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -92,7 +92,7 @@ sub show my $d; if ($playfield) { - my $stars = ($current * $playfield) / $total; + my $stars = int (($current * $playfield) / $total + 0.5); my $percent = int (($current * 100)/$total + 0.5); $d = "$header|".'*'x$stars.' 'x($playfield-$stars)."| ".$percent."\%"; } else { |