procmail
[Top] [All Lists]

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

1998-10-23 02:06:45

Tip for FROM_DAEMON

    Hi, Last night I realised that it is utterly non-efective to do
    FROM_DAEMON test all over my private/public procail modules. It's
    better to cache the results and use fast variable. I've included this
    to section "10.1 Speeding up procmail" in pm-tips.

        o   You can avoid multplse and possible expensive FROM_DAEMON tests
            by cacheing the result at the top of your .procmailrc. We use a
            little trick here to get more verbose logging. The [^daemon] is
            actually a regexp; which will always match and make procmail to
            log: Match on "[^daemon]". We could have used from_daemon=".",
            but that wouldn't tell much in condition line log: Match on "."

                from_daemon = !

                :0
                * ^FROM_DAEMON
                {
                    from_daemon = "[^daemon]"
                }

                #   Later you just use from_daemon like the big brother
                #   Match on "[^daemon]"

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


How to get FROM_DAEMON match: a question

    But, now we come to interesting part. I actually wanted to see what the
    FROM_DAEMON matched and here are my fruitles tries. What's the trick to
    get FROM_DAEMON expanded and attach MATCH operator to it?

    Initial match is ok:

        * ^FROM_DAEMON

             Match on "(^(Precedence...

    But then:

        *  \/^FROM_DAEMON.*

            No match on "\/(^(Precedence...

        *  \/()^FROM_DAEMON.*

            No match on "\/()(^(Precedence

    I know this doesn't work, because FROM_DAEMON is special, but I tried anyway

        * ^\/FROM_DAEMON.*

            No match on "^\/FROM_DAEMON.*"

    "No match" is beginning to sound like a mantra by now....

jari