flags
brace_ends expansion is to stop at }
honour_dollar TRUE if $ is to be expanded,
FALSE if it's just another character
skipping TRUE for recursive calls when the value isn't actually going
to be used (to allow for optimisation)
flags
brace_ends expansion is to stop at }
honour_dollar TRUE if $ is to be expanded,
FALSE if it's just another character
skipping TRUE for recursive calls when the value isn't actually going
to be used (to allow for optimisation)
left if not NULL, a pointer to the first character after the
expansion is placed here (typically used with brace_ends)
resetok_p if not NULL, pointer to flag - write FALSE if unsafe to reset
left if not NULL, a pointer to the first character after the
expansion is placed here (typically used with brace_ends)
resetok_p if not NULL, pointer to flag - write FALSE if unsafe to reset
-expand_string_internal(const uschar * string, esi_flags flags, const uschar ** left,
+expand_string_internal(const uschar * s, esi_flags flags, const uschar ** left,
BOOL *resetok_p, BOOL * textonly_p)
{
rmark reset_point = store_mark();
BOOL *resetok_p, BOOL * textonly_p)
{
rmark reset_point = store_mark();
const uschar * save_expand_nstring[EXPAND_MAXN+1];
int save_expand_nlength[EXPAND_MAXN+1];
BOOL resetok = TRUE, first = TRUE, textonly = TRUE;
const uschar * save_expand_nstring[EXPAND_MAXN+1];
int save_expand_nlength[EXPAND_MAXN+1];
BOOL resetok = TRUE, first = TRUE, textonly = TRUE;
BOOL tainted = is_tainted(res);
debug_printf_indent("%Vexpanded: %.*W\n",
"K---",
BOOL tainted = is_tainted(res);
debug_printf_indent("%Vexpanded: %.*W\n",
"K---",
debug_printf_indent("%Vresult: ",
flags & ESI_SKIPPING ? "K-----" : "\\_____");
if (*res || !(flags & ESI_SKIPPING))
debug_printf_indent("%Vresult: ",
flags & ESI_SKIPPING ? "K-----" : "\\_____");
if (*res || !(flags & ESI_SKIPPING))
debug_printf_indent("%Verror message: %s\n",
f.expand_string_forcedfail ? "K---" : "\\___", expand_string_message);
if (f.expand_string_forcedfail)
debug_printf_indent("%Verror message: %s\n",
f.expand_string_forcedfail ? "K---" : "\\___", expand_string_message);
if (f.expand_string_forcedfail)
+/* Just return whether the string is non-empty after expansion */
+
+BOOL
+expand_string_nonempty(const uschar * string)
+{
+const uschar * s;
+if (!string) return FALSE;
+s = expand_string_internal(string, ESI_HONOR_DOLLAR | ESI_EXISTS_ONLY,
+ NULL, NULL, NULL);
+return s && *s;
+}