Skip to contentSkip to conversation

Additions to earlier more POSIX compliance patch.

PATCH Ian Jones 1 participant 1 message Jun 24, 2021 Util-Linux package

lore
Share & tools
lore

Ian Jones

author
#0 lore raw

Hi,

Apologies, I forgot to update the manpage. I have also modified the prompt to display '(END)' at EOF.

I hope you find these patches acceptable.

Best regards,

Ian

From fc87c44a7bce26fdf4e5048f37d37fc3e059c29b Mon Sep 17 00:00:00 2001
From: Ian Jones <[email protected]>
Date: Thu, 24 Jun 2021 14:14:21 +0100
Subject: [PATCH 3/6] Addition of -e flag to for POSIX compliance.

---
 text-utils/more.1.adoc | 3 +++
 1 file changed, 3 insertions(+)
text-utils/more.1.adoc +3 -0
index 43124cac1..9cb463453 100644
@@ -65,6 +65,9 @@ Prompt with "[Press space to continue, 'q' to quit.]", and display "[Press 'h' f
 *-l*, *--logical*::
 Do not pause after any line containing a *^L* (form feed).
 
+*-e*, *--exit-on-eof*::
+Exit on EOF.
+
 *-f*, *--no-pause*::
 Count logical lines, rather than screen lines (i.e., long lines are not folded).
 
Signature · 1 line
2.20.1

From 2d9001cc3f4eac9f74599b687ca6ea552332ddfc Mon Sep 17 00:00:00 2001
From: Ian Jones <[email protected]>
Date: Thu, 24 Jun 2021 22:02:23 +0100
Subject: [PATCH 6/6] Display '(END)' at EOF.

---
 text-utils/more.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
text-utils/more.c +7 -3
index f4da7724e..d1fab940c 100644
@@ -732,9 +732,13 @@ static void output_prompt(struct more_control *ctl, char *filename)
 		if (filename != NULL) {
 			ctl->prompt_len += printf(_("(Next file: %s)"), filename);
 		} else if (!ctl->no_tty_in && 0 < ctl->file_size) {
-			ctl->prompt_len +=
-			    printf("(%d%%)",
-				   (int)((ctl->file_position * 100) / ctl->file_size));
+            int position = ((ctl->file_position * 100) / ctl->file_size);
+            if (position == 100) {
+		        erase_to_col(ctl, 0);
+                ctl->prompt_len += printf(_("(END)"));
+            } else {
+			    ctl->prompt_len += printf("(%d%%)", position);
+            }
 		}
 		if (ctl->suppress_bell) {
 			ctl->prompt_len +=
Signature · 1 line
2.20.1