summaryrefslogtreecommitdiffstats
path: root/usr.bin/man
diff options
context:
space:
mode:
authorgordon <gordon@FreeBSD.org>2010-10-07 06:34:47 +0000
committergordon <gordon@FreeBSD.org>2010-10-07 06:34:47 +0000
commit97932b573aacd1468e6bef2107b2f5fdb334cd35 (patch)
tree16f3b4bb5415ab67f1cabb3d037e1fb6c0570faa /usr.bin/man
parente795b45f17e98c0b722559fdb5ed217e9ad8f966 (diff)
downloadFreeBSD-src-97932b573aacd1468e6bef2107b2f5fdb334cd35.zip
FreeBSD-src-97932b573aacd1468e6bef2107b2f5fdb334cd35.tar.gz
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)
Diffstat (limited to 'usr.bin/man')
-rw-r--r--usr.bin/man/man.17
-rwxr-xr-xusr.bin/man/man.sh14
2 files changed, 21 insertions, 0 deletions
diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1
index 06ed24e..58f43e5 100644
--- a/usr.bin/man/man.1
+++ b/usr.bin/man/man.1
@@ -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 :
diff --git a/usr.bin/man/man.sh b/usr.bin/man/man.sh
index cca7638..454a3c3 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
OpenPOWER on IntegriCloud