summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-07-15 12:39:07 -0400
committerJakob Kaivo <jkk@ung.org>2020-07-15 12:39:07 -0400
commit344424ffafe5e3b310b5595d897579544abdb90d (patch)
tree26b67577db884cc5766cb77403701369c649e401
parent408d8ecbd73cf8dcb4d9af0e3e965534c1aff03f (diff)
implement =/^G (minus file numbers)
-rw-r--r--more.c9
1 files 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 <ctype.h>
#include <errno.h>
-#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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':