procmail
[Top] [All Lists]

Any logical combination of conditions

2001-04-10 06:55:50
I found another clean way to do my combination: (cond1 AND cond2 AND cond3) OR (cond4 AND cond5) OR cond6 and it is a general way to do this

:0
* cond1
* cond2
* cond3
{ g1=1 }

:0
* cond4
* cond5
{ g2=1 }

:0
* cond6
{ g3=1 }

:0
* 1^0 ! g1 ?? ^^^^
* 1^0 ! g2 ?? ^^^^
* 1^0 ! g3 ?? ^^^^
{
   action
   ...
   action
}

Or maybe I should put the Else flag for efficiency, and I have then:

:0
* cond1
* cond2
* cond3
{ g1=1 }

:0E
* cond4
* cond5
{ g2=1 }

:0E
* cond6
{ g3=1 }

:0
* 1^0 ! g1 ?? ^^^^
* 1^0 ! g2 ?? ^^^^
* 1^0 ! g3 ?? ^^^^
{
   action
   ...
   action
}

Just insure that g1, g2 and g3 are unique within the rc file.

I needed a simple way like this one, which is very general, because I want to generate automatically the procmail code from another program which take as input expressions like cond1 AND cond2 OR cond3 AND cond4 AND cond5 OR cond6 where the AND conditions are grouped.

I don't know if there is really a great loss of performance if I don't put the E flag.

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

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