X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ffmt_compile.c;h=c42f1e3899807a61ce742414a5f74b4baf77950d;hp=d699916a7f9743b1dcc8cc97d7bdfeee971e2267;hb=4f653e8f897068fc803607a5975fa18ab1519bcf;hpb=a107dc40d92e7a37be148816db160325326318e3 diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index d699916..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 */ @@ -610,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 {