Add the ability to display specific manual pages if passed on the

commandline. This mirrors the old (undocumented) GNU man functionality.
Also document this feature in the implementation notes section of
the manpage.

Submitted by:	arundel
Approved by:	wes (mentor implicit)
This commit is contained in:
Gordon Tetlow 2010-10-07 06:34:47 +00:00
parent 41456e2db1
commit 3d9127f1bc
2 changed files with 21 additions and 0 deletions

View File

@ -225,6 +225,13 @@ will search the following paths when considering section 4 manual pages in
.It
.Pa /usr/share/man/man4
.El
.Ss Displaying Specific Manual Files
The
.Nm
utility also supports displaying a specific manual page if passed a path
to the file as long as it contains a
.Sq /
character.
.Sh ENVIRONMENT
The following environment variables affect the execution of
.Nm :

View File

@ -356,6 +356,20 @@ man_display_page() {
man_find_and_display() {
local found_page locpath p path sect
# Check to see if it's a file. But only if it has a '/' in
# the filename.
case "$1" in
*/*) if [ -f "$1" -a -r "$1" ]; then
decho "Found a usable page, displaying that"
found_page=yes
unset use_cat
manpage="$1"
man_display_page
return
fi
;;
esac
IFS=:
for sect in $MANSECT; do
decho "Searching section $sect" 2