X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/13ae67e6d208deea2382c2901488d8a7f278ee23..7711f3fc00259e55f630cfe6104eff3083dc9d77:/sbr/fmt_compile.c diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index dbd86631..50722a7c 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -160,6 +160,7 @@ static struct ftable functable[] = { { "decode", TF_EXPR, FT_LS_DECODE, 0, TFL_PUTS }, { "trim", TF_EXPR, FT_LS_TRIM, 0, 0 }, { "kilo", TF_EXPR, FT_LS_KILO, 0, TFL_PUTS }, + { "kibi", TF_EXPR, FT_LS_KIBI, 0, TFL_PUTS }, { "compval", TF_COMP, FT_LV_COMP, 0, TFL_PUTN }, { "compflag", TF_COMP, FT_LV_COMPFLAG, 0, TFL_PUTN }, { "num", TF_NUM, FT_LV_LIT, 0, TFL_PUTN }, @@ -176,6 +177,7 @@ static struct ftable functable[] = { { "localmbox", TF_LMBOX, FT_LS_LIT, 0, TFL_PUTS }, { "plus", TF_NUM, FT_LV_PLUS_L, 0, TFL_PUTN }, { "minus", TF_NUM, FT_LV_MINUS_L, 0, TFL_PUTN }, + { "multiply", TF_NUM, FT_LV_MULTIPLY_L, 0, TFL_PUTN }, { "divide", TF_NUM, FT_LV_DIVIDE_L, 0, TFL_PUTN }, { "modulo", TF_NUM, FT_LV_MODULO_L, 0, TFL_PUTN }, { "charleft", TF_NONE, FT_LV_CHAR_LEFT, 0, TFL_PUTN }, @@ -222,6 +224,8 @@ static struct ftable functable[] = { { "friendly", TF_COMP, FT_LS_FRIENDLY, FT_PARSEADDR, TFL_PUTS }, { "mymbox", TF_COMP, FT_LV_COMPFLAG, FT_MYMBOX, TFL_PUTN }, + { "getmymbox", TF_COMP, FT_STR, FT_GETMYMBOX, 0 }, + { "getmyaddr", TF_COMP, FT_LS_ADDR, FT_GETMYADDR, TFL_PUTS }, { "unquote", TF_EXPR, FT_LS_UNQUOTE, 0, TFL_PUTS }, @@ -283,7 +287,7 @@ static struct colormap colortable[] = { /* Add new component to the hash table */ #define NEWCOMP(cm,name) do { \ - cm = ((struct comp *) calloc(1, sizeof (struct comp)));\ + cm = ((struct comp *) mh_xcalloc (1, sizeof (struct comp)));\ cm->c_name = getcpy(name);\ cm->c_refcount++;\ ncomp++;\ @@ -405,7 +409,7 @@ fmt_compile(char *fstring, struct format **fmt, int reset_comptable) */ i = strlen(fstring)/2 + 1; if (i==1) i++; - next_fp = formatvec = (struct format *)calloc ((size_t) i, + next_fp = formatvec = (struct format *)mh_xcalloc ((size_t) i, sizeof(struct format)); if (next_fp == NULL) adios (NULL, "unable to allocate format storage"); @@ -561,14 +565,19 @@ do_name(char *sp, int preprocess) if (cm->c_type & CT_ADDR) { CERROR("component used as both date and address"); } - cm->c_tws = (struct tws *) - calloc((size_t) 1, sizeof(*cm->c_tws)); + if (cm->c_tws) { + memset (cm->c_tws, 0, sizeof *cm->c_tws); + } else { + cm->c_tws = mh_xcalloc (1, sizeof *cm->c_tws); + } fp->f_type = preprocess; PUTCOMP(sp); cm->c_type |= CT_DATE; break; case FT_MYMBOX: + case FT_GETMYMBOX: + case FT_GETMYADDR: if (!primed) { ismymbox ((struct mailname *) 0); primed++;