Path: utzoo!attcan!uunet!cs.utexas.edu!tut.cis.ohio-state.edu!ukma!husc6!rice!sun-spots-request From: knutson%sw.MCC.COM@mcc.com (Jim Knutson) Newsgroups: comp.sys.sun Subject: Re: 4.0 man -k not scanning all whatis files Keywords: Software Message-ID: <8905091629.AA09258@marconi.sw.mcc.com> Date: 16 May 89 19:49:35 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 41 Approved: Sun-Spots@rice.edu Original-Date: Tue, 9 May 89 11:29:50 CDT X-Sun-Spots-Digest: Volume 7, Issue 289, message 1 of 18 There are some valid reasons not to concatenate all the whatis files together or lump them into one at build time. If you arrange to install software packages in seperate subtreess (e.g. package/{bin,man,...}) then a user who does a man -k command may find that command listed, but may not be able to use "man command" or run command because his MANPATH and PATH environment variables are not setup to include the correct path. Also, if you use any form of the .../old, .../bin, .../new scheme where there may be multiple commands and man pages with the same name, you would like the man page to correspond with the binary you are running (requires careful choices in setting MANPATH). The following is a shell script which works like man -k but looks at all the whatis files in MANPATH: #! /bin/sh # # apropos - A man -k (keyword lookup) replacement # dirs=`echo ${MANPATH=/usr/man} | sed -e 's;^:;/usr/man:;' \ -e 's;::;:/usr/man:;' -e 's;:$;:/usr/man;' -e 's;:; ;g'` while [ "$1" != "" ]; do found=0 for dir in $dirs; do if [ -f $dir/whatis ]; then if grep -i $1 $dir/whatis; then found=1 fi fi done if [ $found -eq 0 ]; then echo $1: nothing appropriate fi shift done