projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* bug #23163: various minor fixes for the benefit of older Unixes
[mmh]
/
uip
/
scansbr.c
diff --git
a/uip/scansbr.c
b/uip/scansbr.c
index
6fd4bb3
..
1b6a0ed
100644
(file)
--- a/
uip/scansbr.c
+++ b/
uip/scansbr.c
@@
-3,6
+3,10
@@
* scansbr.c -- routines to help scan along...
*
* $Id$
* 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 <h/mh.h>
*/
#include <h/mh.h>
@@
-10,6
+14,7
@@
#include <h/fmt_scan.h>
#include <h/scansbr.h>
#include <h/tws.h>
#include <h/fmt_scan.h>
#include <h/scansbr.h>
#include <h/tws.h>
+#include <h/utils.h>
#ifdef _FSTDIO
# define _ptr _p /* Gag */
#ifdef _FSTDIO
# define _ptr _p /* Gag */
@@
-69,7
+74,8
@@
scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
int unseen, char *folder, long size, int noisy)
{
int i, compnum, encrypted, state;
int unseen, char *folder, long size, int noisy)
{
int i, compnum, encrypted, state;
- char *cp, *tmpbuf, **nxtbuf;
+ unsigned char *cp, *tmpbuf;
+ char **nxtbuf;
char *saved_c_text;
struct comp *cptr;
struct comp **savecomp;
char *saved_c_text;
struct comp *cptr;
struct comp **savecomp;
@@
-92,8
+98,7
@@
scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
width = MAXSCANL;
}
dat[3] = slwidth = width;
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());
if (outnum)
umask(~m_gmprot());
@@
-129,8
+134,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--; )
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
+204,7
@@
scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg,
*/
if ((cptr = wantcomp[CHASH(name)])) {
do {
*/
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;
if (! cptr->c_text) {
cptr->c_text = tmpbuf;
for (cp = tmpbuf + strlen (tmpbuf) - 1;
@@
-327,9
+331,9
@@
finished:
if (datecomp->c_tws == NULL)
adios (NULL, "unable to allocate tws buffer");
*datecomp->c_tws = *dlocaltime ((time_t *) &st.st_mtime);
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 {
} else {
- datecomp->c_flags = 0;
+ datecomp->c_flags &= ~CF_DATEFAB;
}
}
}
}
}
}