[comp.sys.sun] 4.0 man -k not scanning all whatis files

pvo1478@oce.orst.edu (Paul O'Neill) (05/09/89)

A workaround:  Just append all the whatis files together.

__________ TESTED __________

cd /usr/local/man

[ rm whatis ]			( if it's a link to /usr/share/man/whatis )
[ catman -w -M /usr/local/man ] 		( make local's own whatis )

cp -ip /usr/share/man/whatis /usr/share/man/whatis- ( in case you blow it )
cat whatis >> /usr/share/man/whatis  		( append to standard whatis )
mv whatis whatis-     				( keep a copy )
ln -s /usr/share/man/whatis whatis		( link to standard whatis )

__________ UNTESTED __________

If you do "catman -w" regularily from a cron job, look at modifying 
/usr/lib/makewhatis to append them all together.  Remove and touch
/usr/share/man/whatis first.  (Cron job 1 minute earlier?)  Make all 
other whatis's links to /usr/share/man/whatis.  Change "> whatis" to
">> whatis" in /usr/lib/makewhatis.

Paul O'Neill                 pvo@oce.orst.edu
Coastal Imaging Lab
OSU--Oceanography
Corvallis, OR  97331         503-754-3251

knutson%sw.MCC.COM@mcc.com (Jim Knutson) (05/17/89)

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