Re: [EXIM] Newlines in autoreply $lookup's don't work

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Malcolm Beattie
Fecha:  
A: exim-users
Asunto: Re: [EXIM] Newlines in autoreply $lookup's don't work
Philip Hazel writes:
> On Tue, 24 Nov 1998, John Horne wrote:
>
> > > However, if I translate the newlines into the \n when I store the
> > > info in ldap, the resultant lookup does not get the \n characters
> > > translated. So, if I store "Line1\nLine2\nline3\n" in my ldap
> > > schema, it does get returned, but the \n characters are not changed
> > > to newlines.
> > >
> > I think the 'expand' function would do this (?) The manual states it will
> > expand a string a second time - I assume that includes changing escaped
> > characters. Try it. Exim 2.00 manual, page 44.
>
> I'm afraid not. Expansion doesn't include escape sequence translation,
> which happens only for quoted strings when they are input. Maybe there
> should be some operator (escape?) which does process a string for these
> kinds of escapes. Maybe string expansion should in fact interpret them.
> Noted on the Wish list.
>
> Meanwhile, I cannot think of a general way of doing this. If you were to
> limit yourself to a maximum number of newlines per string, you could
> fudge it up using a regular expression. For example, if the maximum is
> 2, instead of writing $value you could write
>
> ${if match{$value}{^(.*)\\\\n(.*)$}{$1\n$2}
> {${if match{$value}{^(.*)\\\\n(.*)\\\\n(.*)$}{$1\n$2\n$3}{$value}}
> }}
>
> to change up to 2 occurrences of \n into newline characters. I haven't
> tried that - it's pretty horrendous, I admit.


If you're desperate, there's always:

perl_startup = sub munge_nl { $_ = shift; s(\\n)(\n)g; return $_ }
...
text = ${perl{munge_pl}{...}}

--Malcolm

--
Malcolm Beattie <mbeattie@???>
Unix Systems Programmer
Oxford University Computing Services

--
*** Exim information can be found at http://www.exim.org/ ***