{
int ptr = 0;
int size = Ustrlen(string)+ 64;
-int item_type;
uschar *yield = store_get(size);
+int item_type;
const uschar *s = string;
uschar *save_expand_nstring[EXPAND_MAXN+1];
int save_expand_nlength[EXPAND_MAXN+1];
case EITEM_EXTRACT:
{
int i;
- int j = 2;
+ int j;
int field_number = 1;
BOOL field_number_set = FALSE;
uschar *save_lookup_value = lookup_value;
/* While skipping we cannot rely on the data for expansions being
available (eg. $item) hence cannot decide on numeric vs. keyed.
- Just read as many arguments as there are. */
+ Read a maximum of 5 arguments (inclding the yes/no) */
if (skipping)
{
while (isspace(*s)) s++;
- while (*s == '{')
+ for (j = 5; j > 0 && *s == '{'; j--)
{
if (!expand_string_internal(s+1, TRUE, &s, skipping, TRUE, &resetok))
goto EXPAND_FAILED; /*{*/
}
while (isspace(*s)) s++;
}
+ if ( Ustrncmp(s, "fail", 4) == 0
+ && (s[4] == '}' || s[4] == ' ' || s[4] == '\t' || !s[4])
+ )
+ {
+ s += 4;
+ while (isspace(*s)) s++;
+ }
if (*s != '}')
{
expand_string_message = US"missing '}' closing extract";
}
}
- else for (i = 0; i < j; i++) /* Read the proper number of arguments */
+ else for (i = 0, j = 2; i < j; i++) /* Read the proper number of arguments */
{
while (isspace(*s)) s++;
if (*s == '{') /*}*/
if (*s++ != '}')
{
expand_string_message = string_sprintf(
- US"missing '}' closing arg %d of extract", i+1);
+ "missing '}' closing arg %d of extract", i+1);
goto EXPAND_FAILED_CURLY;
}
else
{
expand_string_message = string_sprintf(
- US"missing '{' for arg %d of extract", i+1);
+ "missing '{' for arg %d of extract", i+1);
goto EXPAND_FAILED_CURLY;
}
}
if (*s != '{') /*}*/
{
expand_string_message = string_sprintf(
- US"missing '{' for arg %d of listextract", i+1);
+ "missing '{' for arg %d of listextract", i+1);
goto EXPAND_FAILED_CURLY;
}
if (*s++ != '}')
{
expand_string_message = string_sprintf(
- US"missing '}' closing arg %d of listextract", i+1);
+ "missing '}' closing arg %d of listextract", i+1);
goto EXPAND_FAILED_CURLY;
}