Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Oct 2010 06:34:47 +0000 (UTC)
From:      Gordon Tetlow <gordon@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r213507 - head/usr.bin/man
Message-ID:  <201010070634.o976YlOG030724@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gordon
Date: Thu Oct  7 06:34:47 2010
New Revision: 213507
URL: http://svn.freebsd.org/changeset/base/213507

Log:
  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)

Modified:
  head/usr.bin/man/man.1
  head/usr.bin/man/man.sh

Modified: head/usr.bin/man/man.1
==============================================================================
--- head/usr.bin/man/man.1	Thu Oct  7 00:37:40 2010	(r213506)
+++ head/usr.bin/man/man.1	Thu Oct  7 06:34:47 2010	(r213507)
@@ -225,6 +225,13 @@ will search the following paths when con
 .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 :

Modified: head/usr.bin/man/man.sh
==============================================================================
--- head/usr.bin/man/man.sh	Thu Oct  7 00:37:40 2010	(r213506)
+++ head/usr.bin/man/man.sh	Thu Oct  7 06:34:47 2010	(r213507)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010070634.o976YlOG030724>