main.c.diff   [plain text]


--- main.c.orig	2004-07-28 11:17:52.000000000 -0700
+++ main.c	2004-07-28 11:32:26.000000000 -0700
@@ -32,6 +32,7 @@
 public int	quitting;
 public int	secure;
 public int	dohelp;
+public int	more_mode = 0;
 
 #if LOGFILE
 public int	logfile = -1;
@@ -68,6 +69,7 @@
 {
 	IFILE ifile;
 	char *s;
+	extern char *__progname;
 
 #ifdef __EMX__
 	_response(&argc, &argv);
@@ -108,6 +110,9 @@
 	 * 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();
@@ -115,7 +120,16 @@
 	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));
 
@@ -214,7 +228,7 @@
 		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();
 	open_getchr();