From owner-svn-src-head@FreeBSD.ORG Sun Aug 14 16:27:26 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD474106566B; Sun, 14 Aug 2011 16:27:26 +0000 (UTC) (envelope-from ttsestt@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id A7ABD8FC0C; Sun, 14 Aug 2011 16:27:25 +0000 (UTC) Received: by bkat8 with SMTP id t8so3355344bka.13 for ; Sun, 14 Aug 2011 09:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=infYx1xLBFUFDGJwl3UlyvstkuLOLaa2A7RIjGWnxgQ=; b=Lb7QHTc0JheFpdVOvFZD5ULATWBl8FmVcpGRvYXdZIoNBOMzxmvv1hR3TTrG+d3p83 CeqDSKzf8y7zKLK5tnI2FVr3NfVrbDnPzpgKkvDHvBC1plpT3BpCIPCiByko7Ew0kV+h SVzYtyWwQPur4hXFa/WSNlOhIsI3eizN3Kl4A= Received: by 10.204.171.66 with SMTP id g2mr595049bkz.18.1313339244143; Sun, 14 Aug 2011 09:27:24 -0700 (PDT) Received: from localhost ([80.62.217.19]) by mx.google.com with ESMTPS id f9sm308764bkt.3.2011.08.14.09.27.23 (version=SSLv3 cipher=OTHER); Sun, 14 Aug 2011 09:27:23 -0700 (PDT) From: Test Rat To: Gordon Tetlow References: <201010070634.o976YlOG030724__26866.5940188386$1286433305$gmane$org@svn.freebsd.org> Date: Sun, 14 Aug 2011 20:27:19 +0400 In-Reply-To: <201010070634.o976YlOG030724__26866.5940188386$1286433305$gmane$org@svn.freebsd.org> (Gordon Tetlow's message of "Thu, 7 Oct 2010 06:34:47 +0000 (UTC)") Message-ID: <86obzsot5k.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: svn-src-head@freebsd.org, Alexander Best , svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r213507 - head/usr.bin/man X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 16:27:26 -0000 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. $ 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 : %%