From owner-freebsd-bugs@FreeBSD.ORG Mon Oct 10 21:50:10 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3AF2E1065674 for ; Mon, 10 Oct 2011 21:50:10 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id F28058FC12 for ; Mon, 10 Oct 2011 21:50:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p9ALo9dD030196 for ; Mon, 10 Oct 2011 21:50:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p9ALo9qS030195; Mon, 10 Oct 2011 21:50:09 GMT (envelope-from gnats) Resent-Date: Mon, 10 Oct 2011 21:50:09 GMT Resent-Message-Id: <201110102150.p9ALo9qS030195@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Nali Toja Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7CCB4106566B for ; Mon, 10 Oct 2011 21:43:11 +0000 (UTC) (envelope-from nalitoja@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 14D438FC16 for ; Mon, 10 Oct 2011 21:43:10 +0000 (UTC) Received: by wyj26 with SMTP id 26so9888929wyj.13 for ; Mon, 10 Oct 2011 14:43:09 -0700 (PDT) Received: by 10.223.75.137 with SMTP id y9mr34802610faj.14.1318282989792; Mon, 10 Oct 2011 14:43:09 -0700 (PDT) Received: from nil (exit-01a.noisetor.net. [173.254.216.66]) by mx.google.com with ESMTPS id n1sm33829267fad.20.2011.10.10.14.42.59 (version=SSLv3 cipher=OTHER); Mon, 10 Oct 2011 14:43:09 -0700 (PDT) Message-Id: <864nzg7cc8.fsf@gmail.com> Date: Mon, 10 Oct 2011 21:42:31 +0000 From: Nali Toja To: FreeBSD-gnats-submit@FreeBSD.org Cc: Subject: bin/161475: [patch] man(1), treat pipe & files w/o slash X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 Oct 2011 21:50:10 -0000 >Number: 161475 >Category: bin >Synopsis: [patch] man(1), treat pipe & files w/o slash >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Oct 10 21:50:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Nali Toja >Release: FreeBSD 10.0-CURRENT amd64 >Organization: >Environment: >Description: - treat pipe as a manpage - allow to view files that do no start with path delimiter cf. http://docs.freebsd.org/cgi/mid.cgi?20110814171617.GA4980 >How-To-Repeat: $ man dup.2 $ texi2pod.pl ffmpeg.texi | pod2man | man $ ssh foo@bar cat /path/to/man.1.xz | man >Fix: --- view_as_manpage.diff begins here --- Index: usr.bin/man/man.sh =================================================================== --- usr.bin/man/man.sh (revision 226114) +++ usr.bin/man/man.sh (working copy) @@ -404,8 +404,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. + # the filename or looks like a manpage. case "$1" in + *.[0-9ln]*) ;& # fallthrough */*) if [ -f "$1" -a -r "$1" ]; then decho "Found a usable page, displaying that" unset use_cat @@ -898,12 +899,17 @@ do_apropos() { 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 + decho "Displaying from stdin" + man_display_page + fi + for page in $pages; do decho "Searching for $page" man_find_and_display "$page" --- view_as_manpage.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: