summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2014-04-25 18:07:41 +0000
committerschwarze <schwarze@openbsd.org>2014-04-25 18:07:41 +0000
commitdc8a171716feecdb69f2f228b8cb8934753c873f (patch)
tree24761b77b5a10a11527ef9905a409277725476dd
parentRedirecting stderr to /dev/null suppresses all errors. Instead use (diff)
downloadwireguard-openbsd-dc8a171716feecdb69f2f228b8cb8934753c873f.tar.xz
wireguard-openbsd-dc8a171716feecdb69f2f228b8cb8934753c873f.zip
Make more(1) POSIX compliant with respect to the -e option.
By default, "more" now works like "less -e", and "more -e" now works like "less -E", and more never exits just because the file fits on the first screen, like "less -F" would. While documenting this, add some text to the DESCRIPTION explaining how paging works. That allows a very concise description of -e. code change ok millert@ manual page joint work with and ok jmc@
-rw-r--r--usr.bin/less/main.c4
-rw-r--r--usr.bin/less/more.140
-rw-r--r--usr.bin/less/option.c2
3 files changed, 25 insertions, 21 deletions
diff --git a/usr.bin/less/main.c b/usr.bin/less/main.c
index 7d8c9bbde1e..aa222e94110 100644
--- a/usr.bin/less/main.c
+++ b/usr.bin/less/main.c
@@ -56,7 +56,6 @@ static char consoleTitle[256];
extern int less_is_more;
extern int missing_cap;
extern int know_dumb;
-extern int quit_if_one_screen;
extern int pr_type;
@@ -165,9 +164,6 @@ main(argc, argv)
quit(QUIT_OK);
}
- if (less_is_more && get_quit_at_eof())
- quit_if_one_screen = TRUE;
-
#if EDITOR
editor = lgetenv("VISUAL");
if (editor == NULL || *editor == '\0')
diff --git a/usr.bin/less/more.1 b/usr.bin/less/more.1
index ea7cc9dfed5..41535b74618 100644
--- a/usr.bin/less/more.1
+++ b/usr.bin/less/more.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: more.1,v 1.15 2014/04/25 06:31:48 jmc Exp $
+.\" $OpenBSD: more.1,v 1.16 2014/04/25 18:07:41 schwarze Exp $
.\"
.\" Copyright (c) 1988, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -43,11 +43,12 @@
.Op Fl t Ar tag
.Op Ar
.Sh DESCRIPTION
+The
.Nm
-is a filter for paging through text one screenful at a time.
-It uses
-.Xr terminfo 3
-so it can run on a variety of terminals.
+pager displays text one screenful at a time.
+After showing each screenful, it prompts the user for a command.
+Most commands scroll the text or move to a different place
+in the file, while some switch to another file.
If no
.Ar file
is specified, or if
@@ -56,9 +57,23 @@ is a single dash
.Pq Ql - ,
the standard input is used.
.Pp
-This version of the
+When showing the last line of a file,
+.Nm
+displays a prompt indicating end of file and the name of the next file
+to examine, if any.
+It then waits for input from the user.
+Scrolling forward switches to the next file,
+or exits if there is none.
+.Pp
+The
.Nm
-utility is actually
+utility uses
+.Xr terminfo 3
+so it can run on a variety of terminals.
+.Pp
+This version of
+.Nm
+is actually
.Xr less 1
in disguise.
As such, it will also accept options documented in
@@ -73,12 +88,8 @@ The options are as follows:
When changing the display, paint from the top line down.
The default is to scroll from the bottom of the screen.
.It Fl e
-Exit on reaching end-of-file twice
-without an intervening operation.
-The default is to exit as soon as end-of-file is reached.
-If the file is shorter than a single screen
-.Nm
-exits at end-of-file regardless.
+Exit immediately after showing the last line of the last file,
+without prompting the user for a command first.
.It Fl i
Ignore case.
Upper case and lower case are considered identical.
@@ -305,9 +316,6 @@ utility is compliant with the
.St -p1003.1-2008
specification,
though its presence is optional.
-Behavior for the
-.Fl e
-flag differs between this implementation and the specification.
.Pp
Functionality allowing the user to skip (as opposed to scroll)
forward is not currently implemented.
diff --git a/usr.bin/less/option.c b/usr.bin/less/option.c
index ae4db936a76..33ab6f276bd 100644
--- a/usr.bin/less/option.c
+++ b/usr.bin/less/option.c
@@ -706,5 +706,5 @@ get_quit_at_eof()
if (!less_is_more)
return quit_at_eof;
/* When less_is_more is set, the -e flag semantics are different. */
- return quit_at_eof ? OPT_ON : OPT_ONPLUS;
+ return quit_at_eof ? OPT_ONPLUS : OPT_ON;
}