procmail
[Top] [All Lists]

Re: Counting lines / `w' with `f'

2000-02-26 23:58:59
On 26 February 2000, David W. Tamkin <dattier(_at_)mcs(_dot_)net> wrote:
Liviu wrote,

D>     Well, the way I understand it, the only use for "w" here would
D> be to provide a return code for a subsequent ":0 e" recipe, which
D> is something I don't have right now.

The other use for `w' or `W' with `f' is to tell procmail to recover
the previous text if the filtering command returns a non-zero exit
code.  Otherwise, procmail will recover only if the filtering command
refuses to take the input.

    Hmm, interesting point.  I assume that by "refuses to take the
input" you mean the calling Procmail receives a SIGPIPE on write.  Ok,
here's how I understand it:


                      |  with "w" or "W"     |  without "w" or "W"
    ------------------+----------------------+----------------------
    non-zero          |  recovers the        |  happily keeps the
    return code       |  unfiltered message  |  filtered message
    ------------------+----------------------+----------------------
    calling Procmail  |  recovers the        |  recovers the
    receives SIGPIPE  |  unfiltered message  |  unfiltered message 
    ------------------+----------------------+----------------------
    crash after       |  recovers the        |  recovers the
    consuming the     |  unfiltered message  |  unfiltered message
    input             |                      |


    So the only situation when Procmail keeps a possibly invalid result
is when the calling recipe doesn't have an "w" or "W" flag, and the
filter finishes normally but with a non-zero return code.

    Now, in my particular case the filter is formail, and my reading of
the man page is that the only situations when formail returns a non-zero
code are the ones listed under the "DIAGNOSTICS" section.  Since my
formail doesn't invoke any other program, the only applicable case seems
to be "file table full".  But in this situation the recipe is going to
fail anyway... :-)

[...]
Maybe what we really need is standard code for counting body lines
from the first non-blank line through the last non-blank line,
something like this (which has worked for me but is probably flawed):
[...]

    That's another interesting point, but it doesn't provide the right
hint for my MUA.  I really need a valid "Lines:".

    Regards,

    Liviu Daia

-- 
Dr. Liviu Daia               e-mail:   Liviu(_dot_)Daia(_at_)imar(_dot_)ro
Institute of Mathematics     web page: http://www.imar.ro/~daia
of the Romanian Academy      PGP key:  http://www.imar.ro/~daia/daia.asc

<Prev in Thread] Current Thread [Next in Thread>