From: cgoesche Date: Fri, 13 Jun 2025 05:59:28 +0000 (-0400) Subject: more: Add MORE_SHELL_LINES environmental variable X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bc90a54995d5d0074cf03e01f5030219efa74f4f;p=thirdparty%2Futil-linux.git more: Add MORE_SHELL_LINES environmental variable This provides an alternative way to set the number of lines per screenful, with the same effect as the '-n' and '--lines' command line options. [kzak@redhat.com: - use ul_strtou16()] Addresses: #3476 Signed-off-by: Christian Goeschel Ndjomouo Signed-off-by: Karel Zak --- diff --git a/text-utils/more.1.adoc b/text-utils/more.1.adoc index d40b79bae..546214e7e 100644 --- a/text-utils/more.1.adoc +++ b/text-utils/more.1.adoc @@ -199,7 +199,10 @@ Disable exit-on-eof (see option *-e* for more details). Run *more* in "secure" mode. See SECURITY for details. *PAGERSECURE*:: -Equivalent to MORESECURE. +Equivalent to MORESECURE. + +*MORE_SHELL_LINES*:: +Specify the _number_ of lines per screenful. It has the same effect as the '-n' and '--lines' options. See in OPTIONS for details. Also, note that the environment variable's value will be overridden if any of these options are set. == HISTORY @@ -213,7 +216,7 @@ Modified by Geoff Peck, UCB to add underlining, single spacing. Modified by John Foderaro, UCB to add -c and MORE environment variable. -Modified by Christian Goeschel Ndjomouo to add MORESECURE and PAGERSECURE environment variables, and a SECURITY section +Modified by Christian Goeschel Ndjomouo to add MORESECURE, PAGERSECURE and MORE_SHELL_LINES environment variables, and a SECURITY section == SEE ALSO diff --git a/text-utils/more.c b/text-utils/more.c index d87af4354..fa5513fd0 100644 --- a/text-utils/more.c +++ b/text-utils/more.c @@ -42,7 +42,7 @@ * 2010-10-21 Davidlohr Bueso * modified mem allocation handling for util-linux * 2025-04-03 Christian Goeschel Ndjomouo - * modified to add MORESECURE and PAGERSECURE environment variables + * modified to add MORESECURE, PAGERSECURE and MORE_SHELL_LINES environment variables */ #include @@ -2130,6 +2130,9 @@ int main(int argc, char **argv) if (getenv("MORESECURE") || getenv("PAGERSECURE")) ctl.is_secure = 1; + if ((s = getenv("MORE_SHELL_LINES")) && isdigit_string(s)) + ul_strtou16(s, (uint16_t *) &ctl.lines_per_screen, 10); + if ((s = getenv("MORE")) != NULL) env_argscan(&ctl, s);