diff options
author | ru <ru@FreeBSD.org> | 2011-06-03 14:34:38 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2011-06-03 14:34:38 +0000 |
commit | ac14eff506609aa01adf3b7519861b7f6eb43c06 (patch) | |
tree | 4108d557e1262b98ba251da1b502b7dc79403dfc /usr.bin/man/man.1 | |
parent | e43f9045296b6f5823d53836a7a651d2e678c070 (diff) | |
download | FreeBSD-src-ac14eff506609aa01adf3b7519861b7f6eb43c06.zip FreeBSD-src-ac14eff506609aa01adf3b7519861b7f6eb43c06.tar.gz |
When MANCOLOR environment variable is set, enable ANSI color escapes
in grotty(1). This makes it possible to view colorized manpages in
color.
When MANPAGER environment variable is set, use it instead of PAGER.
Why another environment variable, one might ask? With color output
enabled, both a terminal and a pager should support the ANSI color
escapes. On a supporting terminal, less(1) with option -R would be
such a pager, while "more -s" (the current default pager for man(1))
will show garbage. It means a different default pager is needed when
color output is enabled, but many people have PAGER set customary,
and it's unlikely to support ANSI color escapes, so introducing yet
another variable (MANPAGER) seemed like a good option to me:
- if MANPAGER is set, use that unconditionally;
- if you disable color support (it is by default), and don't set
MANPAGER, you get an old behavior: -P pager, $PAGER, "more -s",
in that order;
- if you enable color support (by setting MANCOLOR), and don't set
MANPAGER, we ignore PAGER which is unlikely to support ANSI color
escapes, and you get: -P pager, "less -Rs", in that order;
- you might have good reasons for different man(1) and general
purpose pagers;
- later versions of GNU man(1) support MANPAGER.
Diffstat (limited to 'usr.bin/man/man.1')
-rw-r--r-- | usr.bin/man/man.1 | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1 index 133d536..a9002ec 100644 --- a/usr.bin/man/man.1 +++ b/usr.bin/man/man.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2011 +.Dd June 3, 2011 .Dt MAN 1 .Os .Sh NAME @@ -73,8 +73,12 @@ environment variable. .It Fl P Ar pager Use specified pager. Defaults to +.Ic "less -sR" +if color support is enabled, or .Ic "more -s" . Overrides the +.Ev MANPAGER +environment variable, which in turn overrides the .Ev PAGER environment variable. .It Fl S Ar mansect @@ -289,9 +293,19 @@ Otherwise, if set to a special value .Dq Li tty , and output is to a terminal, the pages may be displayed over the whole width of the screen. -.It Ev PAGER +.It Ev MANCOLOR +If set, enables color support. +.It Ev MANPAGER Program used to display files. -If unset, +.Pp +If unset, and color support is enabled, +.Ic "less -sR" +is used. +.Pp +If unset, and color support is disabled, then +.Ev PAGER +is used. +If that has no value either, .Ic "more -s" is used. .El |