X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fscansbr.c;h=d9d6beef5781fde707262d83f00597f5dc061f31;hb=0364511845929f2b946b7a216289e9954f4a13d6;hp=6fd4bb32fb1cc6c9f3c72f8a193a1adf92cf73f3;hpb=7879ea4084333b448c5a3a49c1cb52023e3808d1;p=mmh diff --git a/uip/scansbr.c b/uip/scansbr.c index 6fd4bb3..d9d6bee 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -3,6 +3,10 @@ * scansbr.c -- routines to help scan along... * * $Id$ + * + * This code is Copyright (c) 2002, by the authors of nmh. See the + * COPYRIGHT file in the root directory of the nmh distribution for + * complete copyright information. */ #include @@ -10,6 +14,7 @@ #include #include #include +#include #ifdef _FSTDIO # define _ptr _p /* Gag */ @@ -92,8 +97,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, width = MAXSCANL; } dat[3] = slwidth = width; - if ((scanl = (char *) malloc((size_t) (slwidth + 2) )) == NULL) - adios (NULL, "unable to malloc scan line (%d bytes)", slwidth+2); + scanl = (char *) mh_xmalloc((size_t) MB_CUR_MAX * (slwidth + 2) ); if (outnum) umask(~m_gmprot()); @@ -129,8 +133,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, used_buf += ncomps+1; *--used_buf = 0; rlwidth = bodycomp && (width > SBUFSIZ) ? width : SBUFSIZ; for (i = ncomps; i--; ) - if ((*nxtbuf++ = malloc(rlwidth)) == NULL) - adios (NULL, "unable to allocate component buffer"); + *nxtbuf++ = mh_xmalloc(rlwidth); } /* @@ -200,7 +203,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, */ if ((cptr = wantcomp[CHASH(name)])) { do { - if (!strcasecmp(name, cptr->c_name)) { + if (!mh_strcasecmp(name, cptr->c_name)) { if (! cptr->c_text) { cptr->c_text = tmpbuf; for (cp = tmpbuf + strlen (tmpbuf) - 1; @@ -327,9 +330,9 @@ finished: if (datecomp->c_tws == NULL) adios (NULL, "unable to allocate tws buffer"); *datecomp->c_tws = *dlocaltime ((time_t *) &st.st_mtime); - datecomp->c_flags = -1; + datecomp->c_flags |= CF_DATEFAB|CF_TRUE; } else { - datecomp->c_flags = 0; + datecomp->c_flags &= ~CF_DATEFAB; } } }