procmail
[Top] [All Lists]

Re: Hacking stdin? (Why doesn't this filter do what I expect)

1997-05-08 05:21:00
On Thu, 8 May 1997 06:43:30 -0400 (EDT),
Robert Nicholson <steffi2(_at_)dgs(_dot_)dgsys(_dot_)com> wrote:
Era was talking about David Tamkin and how he used a "hold space?"
Is this  aprocmail term or David's own invention?

It's a standard sed concept, read the sed man page. 

Do later procmail's cache the current messages headers and or body for
use anywhere in a recipe?

No, you have to do it yourself. It's easy to do, though. 

    HEADER=`sed '/^$/,$d'`
    BODY=`sed '1,/^$/d'`

What's wrong with this idea? Just the potential to exceed memory if a
large message is received?

Nothing inherently "wrong", but yes, it will break if LINEBUF is
exceeded. You could try to set it to something reasonably big, and/or
just break down and resort to a temporary file (just don't start
thinking about what to do when the message is too big to fit on the
disk :-)
  As a good precaution, you could just calculate the size of the
header and the body and compare them to LINEBUF, and revert to doing
something secure instead if you do detect an overflow. (Or simplify a
bit and just compare the size of the entire message to LINEBUF and
panic if it's bigger, on the theory that the body alone will probably
exceed LINEBUF in most cases.)

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>