X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Ffmt_scan.c;h=a8e773a953fd04b8a89c9dbbe91c46b2dc54c4f9;hp=5103dbd772697372477cda28ae083248f9611872;hb=976303d04d3bc2cad0afd5e3d364264783da56c2;hpb=d5b5e6e4813b7fd77dc1664df4304537f3002cf3 diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 5103dbd..a8e773a 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #ifdef HAVE_SYS_TIME_H # include @@ -25,8 +27,6 @@ # include #endif -extern char *formataddr(); /* hook for custom address formatting */ - extern int fmt_norm; /* defined in sbr/fmt_def.c = AD_NAME */ struct mailname fmt_mnull; @@ -324,7 +324,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) cptrimmed(&cp, str, fmt->f_width, fmt->f_fill, ep - cp); break; case FT_STRFW: - adios(NULL, "internal error (FT_STRFW)"); + adios(EX_SOFTWARE, NULL, "internal error (FT_STRFW)"); case FT_NUM: n = snprintf(cp, ep - cp + 1, "%d", value); @@ -607,10 +607,8 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) value = fmt->f_comp->c_tws->tw_flags & TW_DST; break; case FT_LS_822DATE: - str = dasctime(fmt->f_comp->c_tws , TW_ZONE); - break; case FT_LS_PRETTY: - str = dasctime(fmt->f_comp->c_tws, TW_NULL); + str = dasctime(fmt->f_comp->c_tws); break; case FT_LS_PERS: @@ -681,7 +679,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) } else str = mn->m_text; break; - } + } } } break; @@ -777,12 +775,18 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) sp = fmt->f_text; indent = strlen(sp); wid -= indent; + if (wid <= 0) { + adios(EX_SOFTWARE, NULL, "putaddr -- num register (%d) " + "must be greater than label " + "width (%d)", value, indent); + } while( (c = *sp++) && cp < ep) *cp++ = c; while (len > wid) { - /* try to break at a comma; failing that, - * break at a space. - */ + /* + ** try to break at a comma; failing that, + ** break at a space. + */ lastb = 0; sp = lp + wid; while (sp > lp && (c = *--sp) != ',') { if (! lastb && isspace(c))