]> diplodocus.org Git - nmh/blobdiff - sbr/readconfig.c
Very minor cleanup to m_getfld() to remove an increment of j.
[nmh] / sbr / readconfig.c
index 4cf05f1b2db56faa222446601007f0b93f766fb8..0efc9a5ec057366bd714aea70bb2a6190b366796 100644 (file)
@@ -59,7 +59,8 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx)
     }
 
     for (state = FLD;;) {
-       switch (state = m_getfld (state, name, field, sizeof(field), ib)) {
+       int fieldsz = sizeof field;
+       switch (state = m_getfld (state, name, field, &fieldsz, ib)) {
            case FLD:
            case FLDPLUS:
            case FLDEOF:
@@ -70,7 +71,8 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx)
                if (state == FLDPLUS) {
                    cp = getcpy (field);
                    while (state == FLDPLUS) {
-                       state = m_getfld (state, name, field, sizeof(field), ib);
+                       fieldsz = sizeof field;
+                       state = m_getfld (state, name, field, &fieldsz, ib);
                        cp = add (field, cp);
                    }
                    np->n_field = trimcpy (cp);
@@ -106,6 +108,23 @@ readconfig (struct node **npp, FILE *ib, char *file, int ctx)
        break;
     }
 
+    /*
+     * 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
           allow multiple profile entries named "#", because that's