From 344424ffafe5e3b310b5595d897579544abdb90d Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Wed, 15 Jul 2020 12:39:07 -0400 Subject: implement =/^G (minus file numbers) --- more.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/more.c b/more.c index 3f8d4a3..108f70b 100644 --- a/more.c +++ b/more.c @@ -1,7 +1,6 @@ #define _XOPEN_SOURCE 700 #include #include -#include #include #include #include @@ -72,9 +71,9 @@ void jump(const struct more_tty *mt, struct more_file *mf) } } -int more(const struct more_tty *mt, const char *file) +int more(const struct more_tty *mt, const char *path) { - struct more_file mf = more_open(file); + struct more_file mf = more_open(path); if (mf.f == NULL) { retval = 1; @@ -142,7 +141,7 @@ int more(const struct more_tty *mt, const char *file) case 'G': if (count == 0) { - count = INT_MAX; + count = mf.nbytes; } /* FALLTHRU */ case 'g': @@ -216,7 +215,7 @@ int more(const struct more_tty *mt, const char *file) case '=': case CTRL_G: - // display_position(); + printf("%s; File %d/%d; Line %zd; Byte %zd/%zd; %zd%%", path, 0, 0, mf.topline, mf.bytepos[mf.topline], mf.nbytes, 100 * mf.bytepos[mf.topline] / mf.nbytes); break; case 'Z': -- cgit v1.2.1