procmail
[Top] [All Lists]

Re: Getting matched text from FROM_DAEON (also tip to avoid FROM_DAEMON)

1998-10-23 12:22:43
|Fri 1998-10-23 "David W. Tamkin" <dattier(_at_)Mcs(_dot_)Net> list.procmail
|
|              log: Match on "[^daemon]".
| 
| That will work, as the header will always contain at least one colon (and
| some digits too), and you wouldn't apply ^FROM_DAEMON to the body.  But ""
| is quicker to read in the rcfile and quicker for procmail to match on (as I
| understand).

:-) Heh, In theory yes, but the [^daemon] is close to atomic, because it is
one single char class entity for regexp entity. So for readability and LOG
debugging I like [^daemon] more.

| "" would have the same problem, but you could use "!!", which, like "", is
| always a match to any text.  It can also be negated, because "!!!" is a
| non-match to any text.

Using double exclamation marks is an exellent idea, I got a head lock for
seeing only one "!" and I couldn't think further than that. So we settle
for this recommendation:

        o   You can avoid multiple and possible expensive FROM_DAEMON tests
            by cacheing the result at the top of your .procmailrc. You can
            now use variable $from_daemon like the big brother FROM_DAEMON.

                from_daemon = "!"

                :0
                * ^FROM_DAEMON
                {
                    from_daemon = "!!"  # double !! means "OK"
                }

                :0
                *$ ! $from_daemon
                {
                    ..do-it..
                }


jari