procmail
[Top] [All Lists]

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

2000-02-26 09:56:19
Liviu wrote,

D>     Well, the way I understand it, the only use for "w" here would be to
D> provide a return code for a subsequent ":0 e" recipe, which is something
D> 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.  Other-
wise, procmail will recover only if the filtering command refuses to take the
input.

Philip wrote,

G> That hasn't changed in 3.15pre, last I checked.  When I do the above here
G> using 3.15pre I get no Lines: header field for the first (the score was
G> zero, so the recipe failed) and "Lines: 1" for the second.

One thing I tried yesterday was running those recipes with both 3.13.1 and
3.15pre, and they had the same results.

G> Could it be your MTA that's adding the blank line?  What happens when
G> you try:
G>      procmail -d $USER <message-with-no-body

D>    It work fine, of course.

Glad that's answered.  Thank you, Philip.

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):

 :0B # zero or one non-blank character in the body
 * 10^0
 * -9^1 [^      ]
 {
  SCORE = $=

  :0
  * SCORE ?? ()\/.^^
  { LINES = $MATCH }
 }
 :0EB # two or more
 * ()\/[^       ](.|$)*[^       ]
 * 1^1 MATCH ?? ^.*$
 { LINES = $= }
 :0E
 { LINES = indeterminate }

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