#!	/bin/csh
#	@(#)makewhatis.sh	13.1 (RC International) 91/02/02 17:48:47
#
#	invocation:	makewhatis [dir]
#
#		where dir is the directory containing getNAME, by default
#		/usr/lib/getNAME

set workfile = /tmp/mkwhis$$
set getname = /usr/lib/getNAME
if ( $#argv == 1 ) set getname = $1/getNAME

foreach dir ( man[1-8] )
	$getname $dir/* | sed \
		-e 's/\\s[+-][0-9]//g' \
		-e 's/\\s[0-9]//g' \
		-e 's/\\f(..//g' \
		-e 's/\\f.//g' \
		-e 's/\\\&//g' \
	| /usr/ucb/expand \
		-24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100 \
			>>! $workfile
end
sort $workfile | /usr/ucb/unexpand -a > whatis
rm -f $workfile
chmod 644 whatis
