Skip to content

Commit

Permalink
more: restore exit-on-eof if POSIXLY_CORRECT is not set
Browse files Browse the repository at this point in the history
In version 2.38, exit-on-eof has been disabled by default. This change
is annoying for users and forces many users to use 'alias more="more
-e"'. It seems better to force POSIX lovers to use POSIXLY_CORRECT
env. variable and stay backwardly compatible by default.

Addresses: #1703
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2088493
Signed-off-by: Karel Zak <kzak@redhat.com>
  • Loading branch information
karelzak committed Jun 15, 2022
1 parent 140e4c7 commit 28b391c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion text-utils/more.1.adoc
Expand Up @@ -66,7 +66,7 @@ Prompt with "[Press space to continue, 'q' to quit.]", and display "[Press 'h' f
Do not pause after any line containing a *^L* (form feed).

*-e*, *--exit-on-eof*::
Exit on End-Of-File, enabled by default if not executed on terminal.
Exit on End-Of-File, enabled by default if POSIXLY_CORRECT environment variable is not set or if not executed on terminal.

*-f*, *--no-pause*::
Count logical lines, rather than screen lines (i.e., long lines are not folded).
Expand Down
3 changes: 3 additions & 0 deletions text-utils/more.c
Expand Up @@ -2052,8 +2052,11 @@ int main(int argc, char **argv)
if (!(strcmp(program_invocation_short_name, "page")))
ctl.no_scroll++;

ctl.exit_on_eof = getenv("POSIXLY_CORRECT") ? 0 : 1;

if ((s = getenv("MORE")) != NULL)
env_argscan(&ctl, s);

argscan(&ctl, argc, argv);

/* clear any inherited settings */
Expand Down

0 comments on commit 28b391c

Please sign in to comment.