svn commit: r315993 - stable/11/usr.bin/man
Baptiste Daroussin
bapt at FreeBSD.org
Sun Mar 26 18:01:54 UTC 2017
Author: bapt
Date: Sun Mar 26 18:01:53 2017
New Revision: 315993
URL: https://svnweb.freebsd.org/changeset/base/315993
Log:
MFC r315053-r315054, r315056
r315053:
Add share/man if it exists to the MANPATH
localbase is not consistent with base for manpages:
/usr/local/man vs /usr/share/man adding share/man allows to fix that
inconsistency and would permit to remove tons of patches/modifications in the
ports tree
r315054:
Extend functionality MANPATH in man(1) to followup with apropos(1) from
mandoc.
If MANPATH begins with a colon, it is appended to the default list; if it ends
with a colon, it is prepended to the default list; or if it contains two
adjacent colons, the standard search path is inserted between the colons. If
none of these conditions are met, it overrides the standard search path.
Import the MANPATH description from mandoc into the man(1) man page
Reported by: kargl
MFC after: 1 week
r315056:
Remove the warning when MANPATH is set in the environment
The MANPATH environment variable behaviour is documented properly in the manpage
and it now has extended to new feature that allows to make MANPATH env variable
extending the default search path rather than overwriting it making the warning
painful
Reported by: kargl
MFC after: 1 week
Modified:
stable/11/usr.bin/man/man.1
stable/11/usr.bin/man/man.sh
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/usr.bin/man/man.1
==============================================================================
--- stable/11/usr.bin/man/man.1 Sun Mar 26 17:59:51 2017 (r315992)
+++ stable/11/usr.bin/man/man.1 Sun Mar 26 18:01:53 2017 (r315993)
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 26, 2014
+.Dd March 11, 2017
.Dt MAN 1
.Os
.Sh NAME
@@ -295,13 +295,22 @@ Corresponds to the
.Fl m
option.
.It Ev MANPATH
-Used to find the location of the manual files.
-See
-.Xr manpath 1
-for additional information.
-Corresponds to the
-.Fl M
-option.
+The standard search path used by
+.Xr man 1
+may be changed by specifying a path in the
+.Ev MANPATH
+environment variable.
+Invalid paths, or paths without manual databases, are ignored.
+Overridden by
+.Fl M .
+If
+.Ev MANPATH
+begins with a colon, it is appended to the default list;
+if it ends with a colon, it is prepended to the default list;
+or if it contains two adjacent colons,
+the standard search path is inserted between the colons.
+If none of these conditions are met, it overrides the
+standard search path.
.It Ev MANROFFSEQ
Used to determine the preprocessors for the manual source before running
.Xr nroff 1
Modified: stable/11/usr.bin/man/man.sh
==============================================================================
--- stable/11/usr.bin/man/man.sh Sun Mar 26 17:59:51 2017 (r315992)
+++ stable/11/usr.bin/man/man.sh Sun Mar 26 18:01:53 2017 (r315993)
@@ -68,7 +68,23 @@ build_manpath() {
# If the user has set a manpath, who are we to argue.
if [ -n "$MANPATH" ]; then
- return
+ case "$MANPATH" in
+ *:) PREPEND_MANPATH=${MANPATH} ;;
+ :*) APPEND_MANPATH=${MANPATH} ;;
+ *::*)
+ PREPEND_MANPATH=${MANPATH%%::*}
+ APPEND_MANPATH=${MANPATH#*::}
+ ;;
+ *) return ;;
+ esac
+ fi
+
+ if [ -n "$PREPEND_MANPATH" ]; then
+ IFS=:
+ for path in $PREPEND_MANPATH; do
+ add_to_manpath "$path"
+ done
+ unset IFS
fi
search_path
@@ -82,6 +98,13 @@ build_manpath() {
parse_configs
+ if [ -n "$APPEND_MANPATH" ]; then
+ IFS=:
+ for path in $APPEND_MANPATH; do
+ add_to_manpath "$path"
+ done
+ unset IFS
+ fi
# Trim leading colon
MANPATH=${manpath#:}
@@ -238,10 +261,6 @@ manpath_usage() {
# Usage: manpath_warnings
# Display some warnings to stderr.
manpath_warnings() {
- if [ -z "$Lflag" -a -n "$MANPATH" ]; then
- echo "(Warning: MANPATH environment variable set)" >&2
- fi
-
if [ -n "$Lflag" -a -n "$MANLOCALES" ]; then
echo "(Warning: MANLOCALES environment variable set)" >&2
fi
@@ -771,6 +790,8 @@ search_path() {
case "$path" in
*/bin) p="${path%/bin}/man"
add_to_manpath "$p"
+ p="${path%/bin}/share/man"
+ add_to_manpath "$p"
;;
*) ;;
esac
More information about the svn-src-stable
mailing list