#define pinform if (!talked++) inform
struct nexus {
- int (*n_action)();
+ int (*n_action)(struct nexus *n, FILE *fp, int msgnum, long start, long stop);
union {
/* for {OR,AND,NOT}action */
static struct nexus *nexp1(void);
static struct nexus *nexp2(void);
static struct nexus *nexp3(void);
-static struct nexus *newnexus(int (*)(struct nexus *n,
+static struct nexus *newnexus(int (*action)(struct nexus *n,
FILE *fp, int msgnum, long start, long stop));
static int ORaction(struct nexus *n, FILE *fp, int msgnum,
dasctime (&n->n_tws, TW_NULL));
return;
}
- fprintf (stderr, "UNKNOWN(0x%x)\n",
- (unsigned int)(unsigned long) (*n->n_action));
+
+ generic_pointer gp;
+ gp.f = (void (*)(void))n->n_action;
+ fprintf(stderr, "UNKNOWN(%p)\n", gp.v);
}
do {
lp--;
if (advance ((char *) lp, (char *) ep))
- return (1);
+ return 1;
} while (lp > curlp);
return 0;
set = aset;
if ((c = ac) == 0)
- return (0);
+ return 0;
n = *set++;
while (n--)
if (*set++ == c || set[-1] == cc[c])
- return (af);
+ return af;
- return (!af);
+ return !af;
}
char *bp;
char buf[NMH_BUFSIZ], name[NAMESZ];
struct tws *tw;
- m_getfld_state_t gstate = 0;
+ m_getfld_state_t gstate;
NMH_UNUSED (stop);
fseek (fp, start, SEEK_SET);
+ gstate = m_getfld_state_init(fp);
for (bp = NULL;;) {
int bufsz = sizeof buf;
- switch (state = m_getfld (&gstate, name, buf, &bufsz, fp)) {
+ switch (state = m_getfld2(&gstate, name, buf, &bufsz)) {
case FLD:
case FLDPLUS:
- mh_xfree(bp);
+ free(bp);
bp = mh_xstrdup(buf);
while (state == FLDPLUS) {
bufsz = sizeof buf;
- state = m_getfld (&gstate, name, buf, &bufsz, fp);
+ state = m_getfld2(&gstate, name, buf, &bufsz);
bp = add (buf, bp);
}
if (!strcasecmp (name, n->n_datef))
case FMTERR:
if (state == LENERR || state == FMTERR)
inform("format error in message %d", msgnum);
- mh_xfree(bp);
+ free(bp);
return 0;
default:
- adios (NULL, "internal error -- you lose");
+ die("internal error -- you lose");
}
break;
}
state = n->n_after ? (twsort (tw, &n->n_tws) > 0)
: (twsort (tw, &n->n_tws) < 0);
- mh_xfree(bp);
+ free(bp);
return state;
}