X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/869b0d5dc814215b72b1899cf82073d13bb65a97..8664e81329d0811d0b0f35521a850b74ac276da3:/uip/replsbr.c diff --git a/uip/replsbr.c b/uip/replsbr.c index dc3c4f8c..c0ffb726 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -72,6 +72,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, char name[NAMESZ], *scanl; unsigned char *cp; static int dat[5]; /* aux. data for format routine */ + m_getfld_state_t gstate; FILE *out; NMH_UNUSED (msg); @@ -131,9 +132,10 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, /* * pick any interesting stuff out of msg "inb" */ - for (state = FLD;;) { + m_getfld_state_init (&gstate); + for (;;) { int msg_count = sizeof tmpbuf; - state = m_getfld (state, name, tmpbuf, &msg_count, inb); + state = m_getfld (gstate, name, tmpbuf, &msg_count, inb); switch (state) { case FLD: case FLDPLUS: @@ -149,7 +151,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, char_read += msg_count; while (state == FLDPLUS) { msg_count= sizeof tmpbuf; - state = m_getfld(state, name, tmpbuf, &msg_count, inb); + state = m_getfld (gstate, name, tmpbuf, &msg_count, inb); fmt_appendcomp(i, name, tmpbuf); char_read += msg_count; } @@ -157,7 +159,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, while (state == FLDPLUS) { msg_count= sizeof tmpbuf; - state = m_getfld (state, name, tmpbuf, &msg_count, inb); + state = m_getfld (gstate, name, tmpbuf, &msg_count, inb); } break; @@ -171,6 +173,7 @@ replout (FILE *inb, char *msg, char *drft, struct msgs *mp, int outputlinelen, adios (NULL, "m_getfld() returned %d", state); } } + m_getfld_state_destroy (&gstate); /* * format and output the header lines.