summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2012-06-12 21:41:05 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2012-06-12 21:41:05 +0100
commita64a3dfa73b829669d838c8d129b0974360b95a5 (patch)
tree1e16c81b25ac1c06f55e8ced3490e59e7a6b370b /src
parent042eb971b8c1af6d257f207d453b30afeed529b8 (diff)
Change names to "listnamed" and "listcount".
Diffstat (limited to 'src')
-rw-r--r--src/src/expand.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/src/expand.c b/src/src/expand.c
index 2a9e6b4fc..965842611 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -182,12 +182,12 @@ static uschar *op_table_main[] = {
US"l",
US"lc",
US"length",
- US"list",
+ US"listcount",
+ US"listnamed",
US"mask",
US"md5",
US"nh",
US"nhash",
- US"nlist",
US"quote",
US"randint",
US"rfc2047",
@@ -217,12 +217,12 @@ enum {
EOP_L,
EOP_LC,
EOP_LENGTH,
- EOP_LIST,
+ EOP_LISTCOUNT,
+ EOP_LISTNAMED,
EOP_MASK,
EOP_MD5,
EOP_NH,
EOP_NHASH,
- EOP_NLIST,
EOP_QUOTE,
EOP_RANDINT,
EOP_RFC2047,
@@ -5474,10 +5474,25 @@ while (*s != 0)
continue;
}
+ /* count the number of list elements */
+
+ case EOP_LISTCOUNT:
+ {
+ int cnt = 0;
+ int sep = 0;
+ uschar * cp;
+ uschar buffer[256];
+
+ while (string_nextinlist(&sub, &sep, buffer, sizeof(buffer)) != NULL) cnt++;
+ cp = string_sprintf("%d", cnt);
+ yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
+ continue;
+ }
+
/* expand a named list given the name */
- /* handles nested named lists but will confuse the separators in the result */
+ /* handles nested named lists; requotes as colon-sep list */
- case EOP_LIST:
+ case EOP_LISTNAMED:
{
tree_node *t = NULL;
uschar * list;
@@ -5531,7 +5546,7 @@ while (*s != 0)
if (*item == '+') /* list item is itself a named list */
{
- uschar * sub = string_sprintf("${list%s:%s}", suffix, item);
+ uschar * sub = string_sprintf("${listnamed%s:%s}", suffix, item);
item = expand_string_internal(sub, FALSE, NULL, FALSE, TRUE);
}
else if (sep != ':') /* item from non-colon-sep list, re-quote for colon list-separator */
@@ -5560,21 +5575,6 @@ while (*s != 0)
continue;
}
- /* count the number of list elements */
-
- case EOP_NLIST:
- {
- int cnt = 0;
- int sep = 0;
- uschar * cp;
- uschar buffer[256];
-
- while (string_nextinlist(&sub, &sep, buffer, sizeof(buffer)) != NULL) cnt++;
- cp = string_sprintf("%d", cnt);
- yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
- continue;
- }
-
/* mask applies a mask to an IP address; for example the result of
${mask:131.111.10.206/28} is 131.111.10.192/28. */