summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--more.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/more.c b/more.c
index b3bbfb6..5c0de59 100644
--- a/more.c
+++ b/more.c
@@ -52,6 +52,7 @@ struct more_file {
char *buf;
size_t nbuf;
char *path;
+ int eof;
};
static int more_clear = 0;
@@ -82,6 +83,8 @@ static ssize_t more_getline(struct more_file *mf, size_t lineno)
fgetpos(mf->f, &(mf->tlines[mf->nlines - 1]));
if (getline(&(mf->buf), &(mf->nbuf), mf->f) == -1) {
+ mf->nlines--;
+ mf->eof = 1;
return -1;
}