Re: [exim-dev] [exim] Newline-separated lists

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Magnus Holmgren
Dátum:  
Címzett: exim-dev
Tárgy: Re: [exim-dev] [exim] Newline-separated lists
On Wednesday 21 February 2007 11:13, Mike Cardwell wrote:
> * on the Wed, Feb 21, 2007 at 08:05:20AM +0000, Peter Bowyer wrote:
> >> I'd like to suggest a modification of string_nextinlist() to make it
> >> possible to use certain control characters as list separators (as you
> >> probably know, a less-than followed by any punctuation characters in the
> >> beginning of most lists tell Exim that said punctuation character is the
> >> list separator).
> >>
> >> The simplest syntax would be if "<n" meant that newline (\n) is the
> >> separator and "<t" meant tab (\t). "<s" for space might also be useful
> >> (or simply "< ", which doesn't work today since space isn't considered a
> >> punctuation character). Would this be likely to break existing
> >> configurations?
> >
> > I support that - it would remove the need for ugly 'sg'-ing of lists
> > derived from (for example) MySQL queries. I guess there's a chance it
> > might break a config that uses a literal 'n' as a separator, since
> > it's a valid thing to do...


No, string_nextinlist() only accepts characters for which ispunct(c) is true.

> If possible, <\n would be better than <n imo. It's more obvious what
> it's doing, and wont break anyones obscure config. There might be
> reasons why you can't do it where there are 2 chars after the < though?


There are two reasons why I didn't suggest that; one is that string expansion
means that you'd often have to write <\\n, the other is that it means more
code.

On second thought though, it would probably be better if one had to specify an
actual newline by way of either string expansion or quoted-string parsing,
i.e. the patch became

--- src/string.c        7 Feb 2007 11:24:56 -0000       1.12
+++ src/string.c        21 Feb 2007 10:50:11 -0000
@@ -802,7 +802,7 @@


 if (sep <= 0)
   {
-  if (*s == '<' && ispunct(s[1]))
+  if (*s == '<' && (ispunct(s[1]) || isspace(s[1])))
     {
     sep = s[1];
     s += 2;


-- 
Magnus Holmgren        holmgren@???
                       (No Cc of list mail needed, thanks)


"Exim is better at being younger, whereas sendmail is better for
Scrabble (50 point bonus for clearing your rack)" -- Dave Evans