2004-04-21 03:20:56 +00:00
|
|
|
#! /bin/sh
|
|
|
|
root=$PLAN9/man
|
|
|
|
|
|
|
|
while [ $# -gt 0 ] ; do
|
|
|
|
case $1 in
|
|
|
|
[0-9]) sec="$sec $1" ;;
|
|
|
|
*) break ;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ "X$sec" = "X" ] ; then
|
2004-04-21 03:25:35 +00:00
|
|
|
sec=`ls -d $root/man[0-9]* | sed -e 's;/$;;' -e 's;^.*/man;;'`
|
2004-04-21 03:20:56 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
pat='^('`echo $* | sed -e 's; ;|;g'`')' ;
|
|
|
|
for s in $sec ; do
|
|
|
|
if [ -f $root/$s/INDEX ] ; then
|
2004-04-21 03:25:35 +00:00
|
|
|
try=`grep -E $pat $root/man$s/INDEX | sed -e 's;^[^ ]* ;;'` ;
|
2004-04-21 03:20:56 +00:00
|
|
|
fi
|
|
|
|
if [ "X$try" != "X" ] ; then
|
|
|
|
for f in $try ; do
|
2004-04-21 03:25:35 +00:00
|
|
|
files="$files $root/man$s/$f.$s";
|
2004-04-21 03:20:56 +00:00
|
|
|
done
|
|
|
|
try="";
|
|
|
|
fi
|
|
|
|
for f in $* ; do
|
2004-04-21 03:25:35 +00:00
|
|
|
if [ -f $root/man$s/$f.$s ] ; then
|
|
|
|
files="$files $root/man$s/$f.$s" ;
|
2004-04-21 03:20:56 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
files=`echo $files | tr ' ' '\n' | sort -u`;
|
|
|
|
|
|
|
|
if [ "X$files" = "X" ] ; then
|
|
|
|
echo "No manual entry for $*";
|
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
|
|
|
exmac=".de EX\n.ift .ft 5\n.nf\n..\n.de EE\n.ft1\n.fi\n.."
|
|
|
|
( echo -e $exmac ; cat $files ) | nroff -man
|
|
|
|
|