From owner-svn-src-all@FreeBSD.ORG Sun Aug 14 17:16:17 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id E7E2E1065672; Sun, 14 Aug 2011 17:16:17 +0000 (UTC) Date: Sun, 14 Aug 2011 17:16:17 +0000 From: Alexander Best To: Test Rat Message-ID: <20110814171617.GA4980@freebsd.org> References: <201010070634.o976YlOG030724__26866.5940188386$1286433305$gmane$org@svn.freebsd.org> <86obzsot5k.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86obzsot5k.fsf@gmail.com> Cc: Gordon Tetlow , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213507 - head/usr.bin/man X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 17:16:18 -0000 On Sun Aug 14 11, Test Rat wrote: > Gordon Tetlow writes: > > > 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) > > Why the limitation? It's rather painful to prefix manpages with $PWD > on command line. And a useful case of displaying generated on-the-fly > manpages is missed, too, irrespective of GNU man. at the time my issue was that something like 'man /usr/src/share/man/man1/intro.1' didn't work and gordon fixed that to restore gnu man behavior. i never really tried or needed something like in your example to be honest. ;) but if it makes peoples lives easier and doesn't cause any collisions with gnu man behaviour, then i'm in. ;) cheers. alex > > $ man dup.2 > $ texi2pod.pl ffmpeg.texi | pod2man | man > > %% > Index: usr.bin/man/man.sh > =================================================================== > --- usr.bin/man/man.sh (revision 224842) > +++ usr.bin/man/man.sh (working copy) > @@ -403,10 +403,9 @@ > 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 > + # Check to see if it's a troff file. > + case $(file --brief --mime-type "$1") in > + text/troff) if [ -f "$1" -a -r "$1" ]; then > decho "Found a usable page, displaying that" > unset use_cat > manpage="$1" > @@ -898,12 +897,16 @@ > > do_man() { > man_parse_args "$@" > - if [ -z "$pages" ]; then > + if [ -z "$pages" -a -t 0 ]; then > echo 'What manual page do you want?' >&2 > exit 1 > fi > man_setup > > + if [ ! -t 0 ]; then > + man_display_page > + fi > + > for page in $pages; do > decho "Searching for $page" > man_find_and_display "$page" > Index: usr.bin/man/man.1 > =================================================================== > --- usr.bin/man/man.1 (revision 224842) > +++ usr.bin/man/man.1 (working copy) > @@ -232,9 +232,7 @@ > The > .Nm > utility also supports displaying a specific manual page if passed a path > -to the file as long as it contains a > -.Ql / > -character. > +to the file as long as it's a troff file. > .Sh ENVIRONMENT > The following environment variables affect the execution of > .Nm : > %%