]> granicus.if.org Git - neomutt/commitdiff
patch-1.0.bj.lastline.1: Handle last lines in configuration files
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 18 Nov 1999 10:39:21 +0000 (10:39 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 18 Nov 1999 10:39:21 +0000 (10:39 +0000)
nicely, even when they are not terminated by a \n character.

lib.c

diff --git a/lib.c b/lib.c
index d5ecdb0aea287dccc27825a767aa5f1ace88267e..55049008754986c70e522bdbab1541c06a294efd 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -408,6 +408,12 @@ char *mutt_read_line (char *s, size_t *size, FILE *fp, int *line)
        return s;
       offset = ch - s - 1;
     }
+    else if (feof (fp))
+    {
+      /* The last line of fp isn't \n terminated */
+      (*line)++;
+      return s;
+    }
     else
     {
       /* There wasn't room for the line -- increase ``s'' */