X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/869b0d5dc814215b72b1899cf82073d13bb65a97..27ddac6bea3a3d28ba1a28ad54a78e64d4031875:/sbr/readconfig.c diff --git a/sbr/readconfig.c b/sbr/readconfig.c index 0efc9a5e..b25ea99a 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -52,18 +52,18 @@ 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: - case FLDEOF: np = (struct node *) mh_xmalloc (sizeof(*np)); *npp = np; *(npp = &np->n_next) = NULL; @@ -72,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); @@ -91,12 +91,9 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx) *ps->procnaddr = np->n_field; break; } - if (state == FLDEOF) - break; continue; case BODY: - case BODYEOF: adios (NULL, "no blank lines are permitted in %s", file); case FILEEOF: @@ -107,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.