Commit 44986146 44986146463782231f0e5152f353f184fd373d91 by Sergey Poznyakoff

Fixed behaviour of z. when the total number of messages is less than the number …

…of line per page of output.
1 parent 509a78a7
Showing 1 changed file with 6 additions and 1 deletions
...@@ -161,13 +161,18 @@ mail_z (int argc, char **argv) ...@@ -161,13 +161,18 @@ mail_z (int argc, char **argv)
161 int lastpage = total - pagelines + 1; 161 int lastpage = total - pagelines + 1;
162 if (lastpage <= 0) 162 if (lastpage <= 0)
163 lastpage = 1; 163 lastpage = 1;
164
164 if (cursor > (unsigned int)lastpage) 165 if (cursor > (unsigned int)lastpage)
165 { 166 {
166 realcursor = cursor; 167 realcursor = cursor;
167 cursor = lastpage; 168 cursor = lastpage;
169
170 if (cursor + nlines > total)
171 nlines = total - cursor + 1;
172
168 for (i = 0; i < nlines; i++) 173 for (i = 0; i < nlines; i++)
169 { 174 {
170 mail_from(0, NULL); 175 mail_from0 (cursor, 0);
171 cursor++; 176 cursor++;
172 } 177 }
173 cursor = realcursor; 178 cursor = realcursor;
......