Subject: bin/5424: bug in mail(1) scrolling
To: None <gnats-bugs@gnats.netbsd.org>
From: matt debergalis <deberg@mit.edu>
List: netbsd-bugs
Date: 05/08/1998 15:23:34
>Number: 5424
>Category: bin
>Synopsis: the 'z' command in mail scrolls incorrectly
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 8 12:35:01 1998
>Last-Modified:
>Originator: matt debergalis
>Organization:
matt debergalis <deberg@mit.edu> KB1CTH
finger deberg@ai.mit.edu for PGP key
now accessible from AOPS: 730.8212 x4908
[http://www.mit.edu/~deberg/aops.html]
>Release: NetBSD-1.3 (also in -current)
>Environment:
System: NetBSD skyland 1.3 NetBSD 1.3 (SKYLAND) #31: Sat Feb 21 16:25:33 EST 1998 deberg@skyland:/u1/usr/src/sys/arch/i386/compile/SKYLAND i386
>Description:
mail doesn't always scroll correctly. in particular, if the
screen length is 4 greater than some divisor of the number of messages
in the inbox, pressing 'z' will incorrectly display the last page of
messages twice before printing the "On the last screenful of messages"
error.
>How-To-Repeat:
>Fix:
diff against usr.bin/mail/cmd1.c:
--- cmd1.c.orig Fri May 8 15:15:50 1998
+++ cmd1.c Fri May 8 14:58:44 1998
@@ -105,29 +105,29 @@
void *v;
{
char *arg = v;
- int s, size;
+ int size;
+ int maxscreen;
int cur[1];
cur[0] = 0;
size = screensize();
- s = screen;
+ maxscreen = (msgCount - 1) / size;
switch (*arg) {
case 0:
case '+':
- s++;
- if (s * size > msgCount) {
- printf("On last screenful of messages\n");
+ if( screen >= maxscreen ) {
+ printf("On last screenful of messages\n");
return(0);
- }
- screen = s;
- break;
+ }
+ screen++;
+ break;
case '-':
- if (--s < 0) {
+ if( screen <= 0 ) {
printf("On first screenful of messages\n");
return(0);
}
- screen = s;
+ screen--;
break;
default:
>Audit-Trail:
>Unformatted: