On 12 Oct 2000, Lorens Kockum wrote:
> What I do need is local-parts with several DSUFFIXes in. If I
> have a DSUFFIX several times, won't it take only the last one?
It will take the longest. For user-a-b-c, with suffix=-*, it would treat
"-a-b-c" as the suffix.
> Hmmm, maybe it should. Since suffix isn't a regexp, there's not
> a great deal of control over that.
You can use regexes in local_parts, but I'm not sure that actually helps
you much.
> try in this order, stopping when file is found:
>
> .forward-$1-$2-$3
> .forward-$1-$2-default
> .forward-$1-$2
> .forward-$1-default
> .forward-$1
> .forward-default
> .forward
> regular delivery to user
You could use a succession of directors with local_parts settings, but I
agree this would not be very neat. The first one, for example, would
contain
suffix = -*
local_parts = ^[^-]+(-[^-]+)\{3\}\$
file = .forward{$local_part_suffix}
But I think that's going to get very messy. It might be better to write a
really complicated expansion string using ${exists} and regular
expressions, to check for the file you want. Something like this, maybe:
suffix = -*
suffix_optional
file = .forward
${if match{$local_part_suffix}{^(-[^-]+)?(-[^-]+)?(-[^-]+)?\$}
{
${if exists{$home/.forward$1$2$3}{$1$2$3}
{
${if exists{$home/.forward$1$2-default}{$1$2-default}
{
${if exists{$home/.forward$1$2}{$1$2}
{
.... etc. This is very hairy!
}}
}}
}}
Apart from being exceedingly hairy, this is doing to do a lot of
redundant tests in the cases when there are fewer than 3 suffixes.
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.