diff options
-rw-r--r-- | more.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -56,6 +56,7 @@ struct more_file { }; static int more_clear = 0; +static int more_fastexit = 0; static WINDOW *more_win = NULL; static WINDOW *more_status = NULL; @@ -94,6 +95,8 @@ static ssize_t more_getline(struct more_file *mf, size_t lineno) mf->bytepos[0] = 0; } + printf("%s\r", mf->buf); + if (mf->backing != mf->f) { fgetpos(mf->backing, &(mf->tlines[mf->nlines - 1])); fputs(mf->buf, mf->backing); @@ -385,9 +388,12 @@ static int more(struct more_file *mf) int count = 0; while (mf) { - int at_eof = 0; //(mf.topline + LINES >= mf.nlines); + int at_eof = (mf->eof && (mf->topline + LINES >= mf->nlines)); wmove(more_status, 0, 0); if (at_eof) { + if (more_fastexit && mf->next == NULL) { + return 0; + } wprintw(more_status, "%s <EOF>", mf->path); } int c = wgetch(more_status); @@ -690,7 +696,6 @@ int main(int argc, char *argv[]) { setlocale(LC_ALL, ""); - int fastexit = 0; int ignorecase = 0; int compressempty = 0; int backspace = 1; @@ -705,7 +710,7 @@ int main(int argc, char *argv[]) break; case 'e': - fastexit = 1; + more_fastexit = 1; break; case 'i': @@ -790,7 +795,6 @@ int main(int argc, char *argv[]) } } while (argv[optind++]); - (void)fastexit; (void)ignorecase; (void)backspace; |