projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
With mhstore -clobber auto/suffix, when looking for a new filename,
[mmh]
/
sbr
/
mf.c
diff --git
a/sbr/mf.c
b/sbr/mf.c
index
27c06bb
..
fd92e36
100644
(file)
--- a/
sbr/mf.c
+++ b/
sbr/mf.c
@@
-2,8
+2,6
@@
/*
* mf.c -- mail filter subroutines
*
/*
* mf.c -- mail filter subroutines
*
- * $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.
* 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.
@@
-12,13
+10,13
@@
#include <h/mf.h>
#include <ctype.h>
#include <stdio.h>
#include <h/mf.h>
#include <ctype.h>
#include <stdio.h>
+#include <h/utils.h>
/*
* static prototypes
*/
static char *getcpy (char *);
/*
* static prototypes
*/
static char *getcpy (char *);
-static char *add (char *, char *);
-static void compress (char *, char *);
+static void compress (char *, unsigned char *);
static int isat (char *);
static int parse_address (void);
static int phrase (char *);
static int isat (char *);
static int parse_address (void);
static int phrase (char *);
@@
-42,26
+40,12
@@
getcpy (char *s)
for(;;)
pause();
}
for(;;)
pause();
}
- if ((p = malloc ((size_t) (strlen (s) + 2))))
- strcpy (p, s);
+ p = mh_xmalloc ((size_t) (strlen (s) + 2));
+ strcpy (p, s);
return p;
}
return p;
}
-static char *
-add (char *s1, char *s2)
-{
- register char *p;
-
- if (!s2)
- return getcpy (s1);
-
- if ((p = malloc ((size_t) (strlen (s1) + strlen (s2) + 2))))
- sprintf (p, "%s%s", s2, s1);
- free (s2);
- return p;
-}
-
int
isfrom(char *string)
{
int
isfrom(char *string)
{
@@
-71,7
+55,7
@@
isfrom(char *string)
int
int
-lequal (char *a, char *b)
+lequal (unsigned char *a, unsigned char *b)
{
for (; *a; a++, b++)
if (*b == 0)
{
for (; *a; a++, b++)
if (*b == 0)
@@
-147,7
+131,8
@@
seekadrx (char *addrs)
struct adrx *
uucpadrx (char *addrs)
{
struct adrx *
uucpadrx (char *addrs)
{
- register char *cp, *wp, *xp, *yp, *zp;
+ register unsigned char *cp, *wp, *xp, *yp;
+ register char *zp;
register struct adrx *adrxp = &adrxs1;
if (vp == NULL) {
register struct adrx *adrxp = &adrxs1;
if (vp == NULL) {
@@
-220,9
+205,10
@@
uucpadrx (char *addrs)
static void
static void
-compress (char *fp, char *tp)
+compress (char *fp, unsigned char *tp)
{
{
- register char c, *cp;
+ register char c;
+ register unsigned char *cp;
for (c = ' ', cp = tp; (*tp = *fp++) != 0;)
if (isspace (*tp)) {
for (c = ' ', cp = tp; (*tp = *fp++) != 0;)
if (isspace (*tp)) {
@@
-347,8
+333,8
@@
static int ingrp = 0;
static int last_lex = LX_END;
static char *dp = NULL;
static int last_lex = LX_END;
static char *dp = NULL;
-static char *cp = NULL;
-static char *ap = NULL;
+static unsigned char *cp = NULL;
+static unsigned char *ap = NULL;
static char *pers = NULL;
static char *mbox = NULL;
static char *host = NULL;
static char *pers = NULL;
static char *mbox = NULL;
static char *host = NULL;
@@
-433,7
+419,7
@@
getadrx (char *addrs)
while (isspace (*ap))
ap++;
if (cp)
while (isspace (*ap))
ap++;
if (cp)
- sprintf (adr, "%.*s", cp - ap, ap);
+ sprintf (adr, "%.*s", (int)(cp - ap), ap);
else
strcpy (adr, ap);
bp = adr + strlen (adr) - 1;
else
strcpy (adr, ap);
bp = adr + strlen (adr) - 1;
@@
-773,7
+759,8
@@
my_lex (char *buffer)
{
/* buffer should be at least BUFSIZ bytes long */
int i, gotat = 0;
{
/* buffer should be at least BUFSIZ bytes long */
int i, gotat = 0;
- register char c, *bp;
+ register unsigned char c;
+ register char *bp;
/* Add C to the buffer bp. After use of this macro *bp is guaranteed to be within the buffer. */
#define ADDCHR(C) do { *bp++ = (C); if ((bp - buffer) == (BUFSIZ-1)) goto my_lex_buffull; } while (0)
/* Add C to the buffer bp. After use of this macro *bp is guaranteed to be within the buffer. */
#define ADDCHR(C) do { *bp++ = (C); if ((bp - buffer) == (BUFSIZ-1)) goto my_lex_buffull; } while (0)
@@
-934,8
+921,7
@@
mfgets (FILE *in, char **bp)
static char *pp = NULL;
if (pp == NULL)
static char *pp = NULL;
if (pp == NULL)
- if (!(pp = malloc ((size_t) (len = BUFSIZ))))
- return NOTOK;
+ pp = mh_xmalloc ((size_t) (len = BUFSIZ));
for (ep = (cp = pp) + len - 2;;) {
switch (i = getc (in)) {
for (ep = (cp = pp) + len - 2;;) {
switch (i = getc (in)) {
@@
-975,13
+961,8
@@
mfgets (FILE *in, char **bp)
break;
}
if (cp >= ep) {
break;
}
if (cp >= ep) {
- if (!(dp = realloc (pp, (size_t) (len += BUFSIZ)))) {
- free (pp);
- pp = NULL;
- return NOTOK;
- }
- else
- cp += dp - pp, ep = (pp = cp) + len - 2;
+ dp = mh_xrealloc (pp, (size_t) (len += BUFSIZ));
+ cp += dp - pp, ep = (pp = cp) + len - 2;
}
}
}
}
}
}