]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
When MANCOLOR environment variable is set, enable ANSI color escapes
authorRuslan Ermilov <ru@FreeBSD.org>
Fri, 3 Jun 2011 14:34:38 +0000 (14:34 +0000)
committerRuslan Ermilov <ru@FreeBSD.org>
Fri, 3 Jun 2011 14:34:38 +0000 (14:34 +0000)
commita6a3e8561d046a7e9cabc322c055903f47e5d880
tree4108d557e1262b98ba251da1b502b7dc79403dfc
parent0330cb3bf7b1f5c58872cdf0516b2add071e79ef
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.
usr.bin/man/man.1
usr.bin/man/man.sh