Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 1997 00:42:25 -0800 (AKDT)
From:      Steve Howe <un_x@anchorage.net>
To:        freebsd-questions <questions@freebsd.org>
Subject:   man cat
Message-ID:  <Pine.BSF.3.95q.970425003452.9481A-100000@aak.anchorage.net>

next in thread | raw e-mail | index | archive | help

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
------------------------------------------------------------------------------




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970425003452.9481A-100000>