X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/a616a7953d87c3c51afcc8e693c48c37ec000edf..8a97d4892770a49955add690ac2a53bdc6bf2fcf:/sbr/readconfig.c diff --git a/sbr/readconfig.c b/sbr/readconfig.c index b8b1b357..b25ea99a 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -52,15 +52,16 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) char name[NAMESZ], field[BUFSIZ]; register struct node *np; register struct procstr *ps; + m_getfld_state_t gstate = 0; if (npp == NULL && (npp = opp) == NULL) { admonish (NULL, "bug: readconfig called but pump not primed"); return; } - for (state = FLD;;) { + for (;;) { int fieldsz = sizeof field; - switch (state = m_getfld (state, name, field, &fieldsz, ib)) { + switch (state = m_getfld (&gstate, name, field, &fieldsz, ib)) { case FLD: case FLDPLUS: np = (struct node *) mh_xmalloc (sizeof(*np)); @@ -71,7 +72,7 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) cp = getcpy (field); while (state == FLDPLUS) { fieldsz = sizeof field; - state = m_getfld (state, name, field, &fieldsz, ib); + state = m_getfld (&gstate, name, field, &fieldsz, ib); cp = add (field, cp); } np->n_field = trimcpy (cp); @@ -103,6 +104,7 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) } break; } + m_getfld_state_destroy (&gstate); /* * Special handling for the pager processes: lproc and moreproc.