From: Thomas Roessler Date: Thu, 18 Nov 1999 10:39:21 +0000 (+0000) Subject: patch-1.0.bj.lastline.1: Handle last lines in configuration files X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=00a18390a1c0c8d32b1a75a4921b2e97688f1782;p=neomutt patch-1.0.bj.lastline.1: Handle last lines in configuration files nicely, even when they are not terminated by a \n character. --- diff --git a/lib.c b/lib.c index d5ecdb0ae..550490087 100644 --- 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'' */