summaryrefslogtreecommitdiffstats
path: root/contrib/less/main.c
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2000-05-23 05:51:17 +0000
committerps <ps@FreeBSD.org>2000-05-23 05:51:17 +0000
commit4f86a08dc712d931c98124b30e0d97d63fc21649 (patch)
tree870fabd51c68a3aec2554ef44a5bd75293c9fbae /contrib/less/main.c
parentd00f222c77a8ab0c3c81f9d60defbbec4eb69be7 (diff)
downloadFreeBSD-src-4f86a08dc712d931c98124b30e0d97d63fc21649.zip
FreeBSD-src-4f86a08dc712d931c98124b30e0d97d63fc21649.tar.gz
Make less act like more(1) when it is invoked as more.
Obtained from: NetBSD
Diffstat (limited to 'contrib/less/main.c')
-rw-r--r--contrib/less/main.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/contrib/less/main.c b/contrib/less/main.c
index 2c69d87..9f5e1c3 100644
--- a/contrib/less/main.c
+++ b/contrib/less/main.c
@@ -1,3 +1,4 @@
+/* $FreeBSD$ */
/*
* Copyright (C) 1984-2000 Mark Nudelman
*
@@ -29,6 +30,7 @@ public char * progname;
public int quitting;
public int secure;
public int dohelp;
+public int more_mode = 0;
#if LOGFILE
public int logfile = -1;
@@ -60,6 +62,7 @@ main(argc, argv)
{
IFILE ifile;
char *s;
+ extern char *__progname;
#ifdef __EMX__
_response(&argc, &argv);
@@ -99,6 +102,9 @@ main(argc, argv)
* Process command line arguments and LESS environment arguments.
* Command line arguments override environment arguments.
*/
+ if (strcmp(__progname, "more") == 0)
+ more_mode = 1;
+
is_tty = isatty(1);
get_term();
init_cmds();
@@ -106,7 +112,16 @@ main(argc, argv)
init_charset();
init_line();
init_option();
- s = lgetenv("LESS");
+
+ if (more_mode) {
+ scan_option("-E");
+ scan_option("-m");
+ scan_option("-G");
+ scan_option("-f");
+ s = lgetenv("MORE");
+ } else {
+ s = lgetenv("LESS");
+ }
if (s != NULL)
scan_option(save(s));
@@ -197,7 +212,7 @@ main(argc, argv)
quit(QUIT_OK);
}
- if (missing_cap && !know_dumb)
+ if (missing_cap && !know_dumb && !more_mode)
error("WARNING: terminal is not fully functional", NULL_PARG);
init_mark();
raw_mode(1);
OpenPOWER on IntegriCloud