procmail
[Top] [All Lists]

Re: what does 1^0 mean ?

2001-12-19 21:53:34
On 19 Dec, parv wrote:
| in message <20011220030144(_dot_)B81766(_at_)i3(_dot_)atat(_dot_)at>, 
| wrote Peter Pilsl thusly...
| >
| > just parsing the sanitizer-procmailcode into my brain and run into several 
lines like this:
| > 
| >   :0
| >   * 1^0 SECURITY_NOTIFY_VERBOSE ?? [^ ]
| > 
| > While the rest of the expression is clear to me the leading '1^0'
| > remains a mystery. 
| ...
| 
| that's the (easy and sane) way to do the shortcut OR logic in 
| procmailrc.  it means if current condition matches, don't run the
| next condition(s), and get on w/ the "action".
| 

That's not correct. Sean already pointed Peter to the procmailsc man
page but, just so there's no confusion, succeeding scored conditions are
all checked until either a) a non-scored condition in the recipe is not
matched or b) a score of 2147483647 or -2147483647 is reached meaning
automatic success/failure.

| talking of OR and logic, is there a way to combine OR conditions w/
| AND so as not to repeat the recipe/action?  for example take these 2
| recipes w/ same action...
| 
| :0:
| #
| #  convert '\t' to real tab in actual recipe
| #
| * ^To:[ \t]*("")?(<>)?$
| * ^Cc:[ \t]*("")?(<>)?$
| Spam/spam
| 
| :0:
| * 1^0 ^From: .*(allexecs\.com|allsongs(_at_)earthlink\(_dot_)net)
| * 1^0 ^X-RWTH-SpamWarning: .+
| * 1^0 ^Received: .*(resumerabbit\.com|from .*(bora\.net|btamail\.net\.cn)
| Spam/spam
| 

One of probably many ways...

:0
* condition
{ VARIABLE = "something" }

:0
* condition
{ VARIABLE = "something" }

:0
* VARIABLE ?? something
action here

Keep in mind that this works, but continues to needlessly process
recipes in this case.  It's debatable whether that's actually a
simplification in this already simple case. If there is a good reason
to string recipes together like that, but you don't need to run each
one in it's entirety once one matches, you can do something like:

:0
* condition
* condition
{ VARIABLE = "something" }

:0
* ! VARIABLE ?? something
* condition
* condition
{ VARIABLE = "something" }

:0
* VARIABLE ?? something
action here

I'm not sure how much processing that actually saves. If the conditions
are complicated it might be worthwhile, though still less efficient than
just including the action with each recipe.

-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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