]> diplodocus.org Git - nmh/commitdiff
Fixed m_getfld() to not return EOF indicator, so that files need
authorDavid Levine <levinedl@acm.org>
Tue, 25 Feb 2014 02:18:17 +0000 (20:18 -0600)
committerDavid Levine <levinedl@acm.org>
Tue, 25 Feb 2014 02:18:17 +0000 (20:18 -0600)
not end with a newline.

sbr/m_getfld.c
test/mhparam/test-mhparam

index 9884ba4..d278e52 100644 (file)
@@ -630,7 +630,7 @@ m_getfld (m_getfld_state_t *gstate, char name[NAMESZ], char *buf, int *bufsz,
            n = 0;
            for (finished = 0; ! finished; ) {
                while (c != '\n'  &&  c != EOF  &&  n++ < max) {
-                   *cp++ = c = Getc (s);
+                   if ((c = Getc (s)) != EOF) { *cp++ = c; }
                }
 
                if (c != EOF) c = Peek (s);
index 96160c0..cea61a7 100755 (executable)
@@ -165,4 +165,8 @@ set -e
 # check for correctness here.
 mhparam -debug >/dev/null
 
+# check with text file that does not end with newline
+printf 'Editor: emacs' >>"$MH"
+run_test 'mhparam -nocomponent editor' 'emacs'
+
 exit $failed