From b8270a5cba1945a1656188d390ff1e8817087af0 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 28 Aug 2016 07:25:47 +0000 Subject: [PATCH] Check the MORE (or LESS) environment variables after forcing the various more(1) options, so it is possible to change them using MORE. From Ross L Richardson. ok deraadt millert --- usr.bin/less/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/less/main.c b/usr.bin/less/main.c index 73e651b92d9..e0db6063baa 100644 --- a/usr.bin/less/main.c +++ b/usr.bin/less/main.c @@ -118,10 +118,6 @@ main(int argc, char *argv[]) init_prompt(); - s = lgetenv(less_is_more ? "MORE" : "LESS"); - if (s != NULL) - scan_option(estrdup(s)); - if (less_is_more) { /* this is specified by XPG */ quit_at_eof = OPT_ON; @@ -145,6 +141,10 @@ main(int argc, char *argv[]) top_scroll = OPT_OFF; } + s = lgetenv(less_is_more ? "MORE" : "LESS"); + if (s != NULL) + scan_option(estrdup(s)); + #define isoptstring(s) (((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0') while (argc > 0 && (isoptstring(*argv) || isoptpending())) { s = *argv++; -- 2.20.1