:	${PUBKIN?}
:	${TERM?}
TMP=kh$$.tmp
HINT=NO
HINTLIST=hintlist.hyo
FUNC=LIST
LTERM="-T $TERM"
:
H='
==========
khelp [-options] [name(s)]
==========
ksysdoc [-options] [name(s)]
==========
OPTIONS
==========
-w      list the documentation files and subjects
-p      prepare text for printing
==========
PRINTING
==========
ksysdoc -p names(s) | lpr [options]
==========
'
:
case $# in
	0)	clear;echo "$H";exit 0;;
esac
:
while	:
do
case $1 in
	-h)	clear;echo "$H";exit 0;;
	-e)	set -e;;
	-x)	set -x;;
	-w)	FUNC=WHAT;;
	-p)	LTERM='-T dumb';;
	-*)	HINT=YES;;
	*)	break;;
esac
case $# in
	0|1)	break;;
	*)	shift;;
esac
done
:
cd $PUBKIN/MAN
:
trap 'rm -f $TMP;exit' 0 1 2 3 4 14
:
if test $FUNC = WHAT
then
E='
/\.tmp/d
/^#/d
s/\(.*\)\(\.\)\(.*\)/\1/
'
{
ls
cat $HINTLIST
}	| sed -e "$E" > $TMP
sort -u -o $TMP $TMP
kpr -c6 -w79 -p20 $TMP | more
exit
fi
:
if test $FUNC = LIST
then
for i in $@
do
:
FOUND=NO
:
if test -r $i.cat
then
less $i.cat
FOUND=YES
continue
fi
:
if test -r $i.doc
then
kroff $LTERM $i.doc
FOUND=YES
continue
fi
:
if test -r $i.zoo
then
zoo xp $i.zoo | kroff $LTERM -
FOUND=YES
continue
fi
:
BARF=`egrep -l $i $HINTLIST`
if test $?
then
$i -h | pager
FOUND=YES
continue
fi
:
if test -r $i.ref
then
khint $i | pager
FOUND=YES
continue
fi
:
if test $FOUND = NO
then
echo 1>&2 "<no documentation for> $i"
fi
done
exit
fi
