nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] [PATCH] Add pick -reverse switch to print reversed out


From: Robert Elz
Subject: Re: [Nmh-workers] [PATCH] Add pick -reverse switch to print reversed output
Date: Mon, 28 Mar 2016 11:43:48 +0700

Sorry, I have a whole bunch of unread nmh related mail saved
up waiting to read sometime when there is available time ... but this
one caught my eye.

I'd suggest it would be better to change the implementation of that
switch a little, instead on internal variable "reverse", call it
"direction" and init it to one...

        int direction = 1;      /* not int reverse = 0; */

then in
        case REVSW:
                direction = -direction;
                continue;

That allows

pick: -reverse

in the profile, to default to running backwards, and then the
command
        pick -reverse ...
would swap that around and go forward.

Then, in the loop, the 3rd term of the "for" is just

        msgnum += direction;

and the tests in the 1st and 2nd parts of the for stmt need to check
"direction < 0" where they currently just test "reverse" ... it would
actually be nice to avoid the conditional in the test (2nd term), which
would be easy if it was possible to make the test "!=" instead of <= or >=
(is there any way mshnum can go past the bound without being equal to it first?
... if it is somehow possible before the loop starts, that is, if there are
no messages in the range, that could be tested outside the loop.)

kre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]