From owner-freebsd-questions Fri Apr 25 01:51:38 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id BAA03017 for questions-outgoing; Fri, 25 Apr 1997 01:51:38 -0700 (PDT) Received: from iceberg.anchorage.net. (root@iceberg.anchorage.net [207.14.72.150]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id BAA03012 for ; Fri, 25 Apr 1997 01:51:35 -0700 (PDT) Received: from aak.anchorage.net (ai-129 [207.14.72.129]) by iceberg.anchorage.net. (8.6.11/8.7.3) with SMTP id XAA11674 for ; Thu, 24 Apr 1997 23:48:43 -0800 Date: Fri, 25 Apr 1997 00:42:25 -0800 (AKDT) From: Steve Howe X-Sender: abc@aak.anchorage.net To: freebsd-questions Subject: man cat Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk this is my solution to anyone with problems with manpages, or for anyone that doesn't like "cat" pages taking up their disk space. they use MANPATH, so i deleted /usr/bin/manpath and /etc/manpath* and all my cat pages. it's just a quick hack, but i'm happy now! i know there's a million people that can do things better, this is just for the few dumber than me! :) ------------------------------------------------------------------------------- #!/bin/sh # # man -- open applicable manpages. mpath=`echo $MANPATH | tr : " "` if [ $# = 0 ]; then echo usage: man [n] keyword; exit 1; fi if [ ! "$mpath" ]; then echo error: MANPATH is null; exit 1; fi if which $PAGER; then pager=$PAGER; else pager="more -s"; fi if [ $1 = 1 -o $1 = 2 -o $1 = 3 -o $1 = 4 -o $1 = 5 -o $1 = 6 \ -o $1 = 7 -o $1 = 8 -o $1 = 9 -o $1 = l -o $1 = n ]; then o=$1; shift; fi while [ $1 ]; do found=0; for mdir in $mpath; do if [ $o ]; then gzip -cd $mdir/man$o/$1.$o.gz 2>&-; if [ $? = 0 ]; then found=1; fi else for n in 1 2 3 4 5 6 7 8 9 l n; do gzip -cd $mdir/man$n/$1.$n.gz 2>&-; if [ $? = 0 ]; then found=1; fi done fi done; if [ $found = 0 ]; then echo $1: nothing appropriate; fi; shift done | nroff -man | $pager exit 0 ------------------------------------------------------------------------------ #!/bin/sh # # apropos -- search the whatis database for keywords. mpath=`echo $MANPATH | tr : " "` if [ $# = 0 ]; then echo usage: apropos keyword; exit 1; fi if [ ! "$mpath" ]; then echo error: MANPATH is null; exit 1; fi if which $PAGER; then pager=$PAGER; else pager=more; fi while [ $1 ]; do found=0 for mdir in $mpath; do grep -i "$1" $mdir/whatis; if [ $? = 0 ]; then found=1; fi done; if [ $found = 0 ]; then echo $1: nothing appropriate; fi; shift done | $pager exit 0 ------------------------------------------------------------------------------