X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Ffmt_compile.c;h=c42f1e3899807a61ce742414a5f74b4baf77950d;hb=a3ef57491a1bc4d2e227b14a8e838ffb6c5b5f63;hp=a478acb788c585e25aa9b1b4ceb639849236c6e3;hpb=cafee7a804b8aa53166065e988ec0fc387862fc8;p=mmh diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index a478acb..c42f1e3 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -53,6 +53,9 @@ extern struct mailname fmt_mnull; #define TF_NOP 8 /* like expr but no result */ /* ftable->flags */ +/* NB that TFL_PUTS is also used to decide whether the test + * in a "%<(function)..." should be a string or numeric one. + */ #define TFL_PUTS 1 /* implicit putstr if top level */ #define TFL_PUTN 2 /* implicit putnum if top level */ @@ -149,6 +152,8 @@ static struct ftable functable[] = { { "mymbox", TF_COMP, FT_LV_COMPFLAG, FT_MYMBOX, TFL_PUTN }, { "addtoseq", TF_STR, FT_ADDTOSEQ, 0, 0 }, + { "unquote", TF_EXPR, FT_LS_UNQUOTE, 0, TFL_PUTS}, + { NULL, 0, 0, 0, 0 } }; @@ -181,7 +186,7 @@ static struct ftable functable[] = { #define PUTC(c) NEW(FT_CHAR,0,0); fp->f_char = (c); static char *format_string; -static char *usr_fstring; /* for CERROR */ +static unsigned char *usr_fstring; /* for CERROR */ #define CERROR(str) compile_error (str, cp) @@ -608,7 +613,14 @@ do_if(char *sp) if (ftbl->f_type >= IF_FUNCS) fp->f_type = ftbl->extra; else { - LV (FT_IF_V_NE, 0); + /* Put out a string test or a value test depending + * on what this function's return type is. + */ + if (ftbl->flags & TFL_PUTS) { + LV (FT_IF_S, 0); + } else { + LV (FT_IF_V_NE, 0); + } } } else {