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;;) {
- switch (state = m_getfld (state, name, field, sizeof(field), ib)) {
+ for (;;) {
+ int fieldsz = sizeof field;
+ 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;
if (state == FLDPLUS) {
cp = getcpy (field);
while (state == FLDPLUS) {
- state = m_getfld (state, name, field, sizeof(field), ib);
+ fieldsz = sizeof field;
+ state = m_getfld (&gstate, name, field, &fieldsz, ib);
cp = add (field, cp);
}
np->n_field = trimcpy (cp);
*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:
}
break;
}
+ m_getfld_state_destroy (&gstate);
+
+ /*
+ * Special handling for the pager processes: lproc and moreproc.
+ *
+ * If they are not set by the profile, use the callers $PAGER if
+ * available, otherwise set them to DEFAULT_PAGER.
+ */
+ if (lproc == NULL) {
+ lproc = getenv("PAGER");
+ if (lproc == NULL || lproc[0] == '\0')
+ lproc = DEFAULT_PAGER;
+ }
+ if (moreproc == NULL) {
+ moreproc = getenv("PAGER");
+ if (moreproc == NULL || moreproc[0] == '\0')
+ moreproc = DEFAULT_PAGER;
+ }
if (opp == NULL) {
/* Check for duplicated non-null profile entries. Except