X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=sbr%2Ffmt_scan.c;h=a8e773a953fd04b8a89c9dbbe91c46b2dc54c4f9;hb=850059f6637354d31129f303151f9f7d30514c9e;hp=113b8cfff3ed44199da5a565adb32f1935542ab1;hpb=2e5668919988fce4e523cbf2294698841b1106a0;p=mmh diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 113b8cf..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); @@ -679,7 +679,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) } else str = mn->m_text; break; - } + } } } break; @@ -775,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))