Additions to earlier more POSIX compliance patch.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ian@xxxxxxxxxxxxxxxxx>
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(+)

diff --git a/text-utils/more.1.adoc b/text-utils/more.1.adoc
index 43124cac1..9cb463453 100644
--- a/text-utils/more.1.adoc
+++ b/text-utils/more.1.adoc
@@ -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).
 
-- 
2.20.1

>From 2d9001cc3f4eac9f74599b687ca6ea552332ddfc Mon Sep 17 00:00:00 2001
From: Ian Jones <ian@xxxxxxxxxxxxxxxxx>
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(-)

diff --git a/text-utils/more.c b/text-utils/more.c
index f4da7724e..d1fab940c 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -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 +=
-- 
2.20.1


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux