X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/9514ca81bd12a47df977822efc14ff285bd5bc10..0d0d0e65a4c093f3f8827d4cd3375dcde4d4aab0:/uip/fmttest.c diff --git a/uip/fmttest.c b/uip/fmttest.c index 5f52fdc3..d848bea0 100644 --- a/uip/fmttest.c +++ b/uip/fmttest.c @@ -11,6 +11,7 @@ #include #include #include +#include "../sbr/m_maildir.h" #define FMTTEST_SWITCHES \ X("form formatfile", 0, FORMSW) \ @@ -286,8 +287,7 @@ main (int argc, char **argv) */ if (!dump && compargs.size == 0 && msgs.size == 0) { - adios (NULL, "usage: [switches] [+folder] msgs | strings...", - invo_name); + adios(NULL, "usage: [switches] [+folder] msgs | strings..."); } /* @@ -584,7 +584,7 @@ process_single_file(FILE *in, struct msgs_array *comps, int *dat, int msgsize, { int i, state; char name[NAMESZ], rbuf[NMH_BUFSIZ]; - m_getfld_state_t gstate = 0; + m_getfld_state_t gstate; struct comp *c; int bufsz; @@ -616,9 +616,10 @@ process_single_file(FILE *in, struct msgs_array *comps, int *dat, int msgsize, * Read in the message and process the components */ + gstate = m_getfld_state_init(in); for (;;) { bufsz = sizeof(rbuf); - state = m_getfld(&gstate, name, rbuf, &bufsz, in); + state = m_getfld2(&gstate, name, rbuf, &bufsz); switch (state) { case FLD: case FLDPLUS: @@ -626,14 +627,14 @@ process_single_file(FILE *in, struct msgs_array *comps, int *dat, int msgsize, if (i != -1) { while (state == FLDPLUS) { bufsz = sizeof(rbuf); - state = m_getfld(&gstate, name, rbuf, &bufsz, in); + state = m_getfld2(&gstate, name, rbuf, &bufsz); fmt_appendcomp(i, name, rbuf); } } while (state == FLDPLUS) { bufsz = sizeof(rbuf); - state = m_getfld(&gstate, name, rbuf, &bufsz, in); + state = m_getfld2(&gstate, name, rbuf, &bufsz); } break; @@ -641,12 +642,12 @@ process_single_file(FILE *in, struct msgs_array *comps, int *dat, int msgsize, if (fmt_findcomp("body")) { if ((i = strlen(rbuf)) < outwidth) { bufsz = min (outwidth, (int) sizeof rbuf - i); - m_getfld(&gstate, name, rbuf + i, &bufsz, in); + m_getfld2(&gstate, name, rbuf + i, &bufsz); } fmt_addcomptext("body", rbuf); } - /* FALLTHRU */ + goto finished; default: goto finished; @@ -1302,10 +1303,10 @@ insert (struct mailname *np) return 0; for (mp = &mq; mp->m_next; mp = mp->m_next) { - if (!strcasecmp (np->m_host ? np->m_host : "", - mp->m_next->m_host ? mp->m_next->m_host : "") && - !strcasecmp (np->m_mbox ? np->m_mbox : "", - mp->m_next->m_mbox ? mp->m_next->m_mbox : "")) + if (!strcasecmp (FENDNULL(np->m_host), + FENDNULL(mp->m_next->m_host)) && + !strcasecmp (FENDNULL(np->m_mbox), + FENDNULL(mp->m_next->m_mbox))) return 0; } if (!ccme && ismymbox (np))