projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Up version string to 1.3-dev for the CVS trunk.
[mmh]
/
uip
/
replsbr.c
diff --git
a/uip/replsbr.c
b/uip/replsbr.c
index
0b0ba6e
..
a415346
100644
(file)
--- a/
uip/replsbr.c
+++ b/
uip/replsbr.c
@@
-12,6
+12,7
@@
#include <h/mh.h>
#include <h/addrsbr.h>
#include <h/fmt_scan.h>
#include <h/mh.h>
#include <h/addrsbr.h>
#include <h/fmt_scan.h>
+#include <h/utils.h>
#include <sys/file.h> /* L_SET */
#include <errno.h>
#include <sys/file.h> /* L_SET */
#include <errno.h>
@@
-78,7
+79,8
@@
replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
register char **ap;
register struct comp **savecomp;
int char_read = 0, format_len, mask;
register char **ap;
register struct comp **savecomp;
int char_read = 0, format_len, mask;
- char name[NAMESZ], *scanl, *cp;
+ char name[NAMESZ], *scanl;
+ unsigned char *cp;
FILE *out;
mask = umask(~m_gmprot());
FILE *out;
mask = umask(~m_gmprot());
@@
-104,8
+106,7
@@
replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
*--savecomp = NULL; /* point at zero'd end minus 1 */
for (i = ncomps; i--; )
*--savecomp = NULL; /* point at zero'd end minus 1 */
for (i = ncomps; i--; )
- if (!(*nxtbuf++ = malloc(SBUFSIZ)))
- adios (NULL, "unable to allocate component buffer");
+ *nxtbuf++ = mh_xmalloc(SBUFSIZ);
nxtbuf = compbuffers; /* point at start */
tmpbuf = *nxtbuf++;
nxtbuf = compbuffers; /* point at start */
tmpbuf = *nxtbuf++;
@@
-159,10
+160,12
@@
replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen,
*/
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)) {
char_read += msg_count;
if (! cptr->c_text) {
char_read += msg_count;
if (! cptr->c_text) {
- cptr->c_text = tmpbuf;
+ i = strlen(cptr->c_text = tmpbuf) - 1;
+ if (tmpbuf[i] == '\n')
+ tmpbuf[i] = '\0';
*--savecomp = cptr;
tmpbuf = *nxtbuf++;
} else {
*--savecomp = cptr;
tmpbuf = *nxtbuf++;
} else {
@@
-230,7
+233,7
@@
finished:
}
}
i = format_len + char_read + 256;
}
}
i = format_len + char_read + 256;
- scanl = malloc ((size_t) i + 2);
+ scanl = mh_xmalloc ((size_t) i + 2);
dat[0] = 0;
dat[1] = 0;
dat[2] = 0;
dat[0] = 0;
dat[1] = 0;
dat[2] = 0;
@@
-291,11
+294,9
@@
static unsigned int bufsiz=0; /* current size of buf */
int i = dst - buf;\
int n = last_dst - buf;\
bufsiz += ((dst + len - bufend) / BUFINCR + 1) * BUFINCR;\
int i = dst - buf;\
int n = last_dst - buf;\
bufsiz += ((dst + len - bufend) / BUFINCR + 1) * BUFINCR;\
- buf = realloc (buf, bufsiz);\
+ buf = mh_xrealloc (buf, bufsiz);\
dst = buf + i;\
last_dst = buf + n;\
dst = buf + i;\
last_dst = buf + n;\
- if (! buf)\
- adios (NULL, "formataddr: couldn't get buffer space");\
bufend = buf + bufsiz;\
}
bufend = buf + bufsiz;\
}
@@
-324,9
+325,7
@@
formataddr (char *orig, char *str)
/* if we don't have a buffer yet, get one */
if (bufsiz == 0) {
/* if we don't have a buffer yet, get one */
if (bufsiz == 0) {
- buf = malloc (BUFINCR);
- if (! buf)
- adios (NULL, "formataddr: couldn't allocate buffer space");
+ buf = mh_xmalloc (BUFINCR);
last_dst = buf; /* XXX */
bufsiz = BUFINCR - 6; /* leave some slop */
bufend = buf + bufsiz;
last_dst = buf; /* XXX */
bufsiz = BUFINCR - 6; /* leave some slop */
bufend = buf + bufsiz;
@@
-393,8
+392,8
@@
insert (struct mailname *np)
return 0;
for (mp = &mq; mp->m_next; mp = mp->m_next) {
return 0;
for (mp = &mq; mp->m_next; mp = mp->m_next) {
- if (!strcasecmp (np->m_host, mp->m_next->m_host)
- && !strcasecmp (np->m_mbox, mp->m_next->m_mbox))
+ if (!mh_strcasecmp (np->m_host, mp->m_next->m_host)
+ && !mh_strcasecmp (np->m_mbox, mp->m_next->m_mbox))
return 0;
}
if (!ccme && ismymbox (np))
return 0;
}
if (!ccme && ismymbox (np))