[Exim] Patch for Exim 4 wish list #181 (trivial): Caseless "…

Pàgina inicial
Delete this message
Reply to this message
Autor: Oliver Eikemeier
Data:  
A: exim-users
CC: Philip Hazel, Sheldon Hearn
Assumpte: [Exim] Patch for Exim 4 wish list #181 (trivial): Caseless "eq" expansion condition
The following patch gives you a 'eqi' operator,
which is like 'eq', only case-insensitive (ASCII only):

--- wishlist-eqi.patch begins here ---
#
# (Exim 4 wish list #181) Caseless "eq" expansion condition
# - eqi = caseless eq
#
--- src/expand.c.orig    Mon Aug 18 14:52:54 2003
+++ src/expand.c    Wed Aug 27 14:52:54 2003
@@ -1482,6 +1482,7 @@



 /* eq:   tests for string equality
+eqi:     caseless test for string equality
 match:   does a regular expression match and sets up the numerical
            variables if it succeeds
 crypteq: encrypts plaintext and compares against an encrypted text, using
@@ -1491,6 +1492,7 @@



 else if (Ustrcmp(name, "eq") == 0 ||
+         Ustrcmp(name, "eqi") == 0 ||
          Ustrcmp(name, "match") == 0 ||
          Ustrcmp(name, "crypteq") == 0 ||
          !isalpha(name[0]))
@@ -1565,7 +1567,7 @@
     break;


     case 'e':   /* Straight text comparison */
-    *yield = (Ustrcmp(sub[0], sub[1]) == 0) == testfor;
+    *yield = (((name[2] == 'i')? strcmpic(sub[0], sub[1]) : Ustrcmp(sub[0], sub[1])) == 0) == testfor;
     break;


     case 'm':   /* Regular expression match */
--- wishlist-eqi.patch ends here ---


Regrads
    Oliver