aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/man/man.sh
diff options
context:
space:
mode:
authorGordon Tetlow <gordon@FreeBSD.org>2010-10-07 06:34:47 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2010-10-07 06:34:47 +0000
commit3d9127f1bc014bf3dd3d02a0bb297efa84564887 (patch)
tree16f3b4bb5415ab67f1cabb3d037e1fb6c0570faa /usr.bin/man/man.sh
parent41456e2db16f2a311f23d69d359466b3f66964e4 (diff)
downloadsrc-3d9127f1bc014bf3dd3d02a0bb297efa84564887.tar.gz
src-3d9127f1bc014bf3dd3d02a0bb297efa84564887.zip
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)
Notes
Notes: svn path=/head/; revision=213507
Diffstat (limited to 'usr.bin/man/man.sh')
-rwxr-xr-xusr.bin/man/man.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh
index cca7638cf082..454a3c31379f 100755
--- a/usr.bin/man/man.sh
+++ b/usr.bin/man/man.sh
@@ -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