Re: [exim] conditionals in exim

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: Steffen Heil
CC: exim-users
Subject: Re: [exim] conditionals in exim
On Wed, 3 Jan 2007, Steffen Heil wrote:

> In some placed I have
> condition = ${if somecondition {1}{0}}
> Why can't I gust write
> condition = somecondition


Because of the general way that Exim is built. However, you can write

condition = ${if somecondition}

which is only 6 more characters. This syntax was introduced at release
4.50.

When Exim is interpreting an ACL or a router, it does not know that
"condition" is a condition tester. It just expands the right-hand side
like it does for any other option/condition. Later, when it processes
"condition", it looks for the special values indicating true or false.
Remember, you can write things like

condition = ${lookup ...}

or any other kind of expansion item. What you want to write, that is,
something like

condition = >{$message_size}{100K}

is a different kind of syntax to a general expansion string, and would
therefore need to be handled by special-purpose code that was different
to all the other ACL conditions or router options.

> As far as I understand string expansion, this should be easy to implement
> (just remove condition checks and would also make things a lot easier, as we
> could then also use:
>
> condition = ${or {cond1}{cond2}{cond3}...}


That really isn't much less tricky than

condition = ${if or {{cond1}{cond2}{cond3}...}}

is it? All I added was "if " and wrapped the conds in braces.

> As in other languages
> if x then true else false
> is pure sugar, which should be removed...


Exim expansion strings are not really a language... :-)


-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book