summaryrefslogtreecommitdiffstats
path: root/lib/libcurses
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1994-09-24 14:16:04 +0000
committerache <ache@FreeBSD.org>1994-09-24 14:16:04 +0000
commitb035e6b80667654a294b7053cf110f28d6dff0cb (patch)
treef4b7d34be2a588ce896168f156d32f50a193a99f /lib/libcurses
parent58acd4e66c3f23a40e9f4d80d8d23557c480592c (diff)
downloadFreeBSD-src-b035e6b80667654a294b7053cf110f28d6dff0cb.zip
FreeBSD-src-b035e6b80667654a294b7053cf110f28d6dff0cb.tar.gz
Fix bug in %i format, second argument not incremented
Diffstat (limited to 'lib/libcurses')
-rw-r--r--lib/libcurses/tscroll.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libcurses/tscroll.c b/lib/libcurses/tscroll.c
index 359b396..a3326a9 100644
--- a/lib/libcurses/tscroll.c
+++ b/lib/libcurses/tscroll.c
@@ -66,7 +66,7 @@ __tscroll(cap, n1, n2)
int n1, n2;
{
static char result[MAXRETURNSIZE];
- int c, n;
+ int c, n, increment = 0;
char *dp;
if (cap == NULL)
@@ -94,6 +94,8 @@ __tscroll(cap, n1, n2)
two: *dp++ = n / 10 | '0';
one: *dp++ = n % 10 | '0';
n = n2;
+ if (increment)
+ n++;
continue;
case '>':
if (n > *cap++)
@@ -108,6 +110,7 @@ one: *dp++ = n % 10 | '0';
*dp++ = n;
continue;
case 'i':
+ increment = 1;
n++;
continue;
case '%':
OpenPOWER on IntegriCloud