1993-12-21 06:28:00 +03:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
1997-11-01 18:06:09 +03:00
|
|
|
# written by matthew green <mrg@eterna.com.au>, based on the
|
|
|
|
# original by J.T. Conklin <jtc@netbsd.org> and Thorsten
|
|
|
|
# Frueauf <frueauf@ira.uka.de>.
|
1997-08-04 07:01:59 +04:00
|
|
|
#
|
1995-05-12 03:03:44 +04:00
|
|
|
# Public domain.
|
1993-12-21 06:28:00 +03:00
|
|
|
#
|
|
|
|
|
1997-11-01 18:06:09 +03:00
|
|
|
trap "rm -f /tmp/makewhatislist$$ /tmp/whatis$$; exit 1" 1 2 15
|
1993-12-21 06:28:00 +03:00
|
|
|
|
|
|
|
MANDIR=${1-/usr/share/man}
|
1997-11-01 18:06:09 +03:00
|
|
|
LIST=/tmp/makewhatislist$$
|
|
|
|
TMP=/tmp/whatis$$
|
1993-12-21 06:28:00 +03:00
|
|
|
if test ! -d "$MANDIR"; then
|
|
|
|
echo "makewhatis: $MANDIR: not a directory"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1997-11-01 18:06:09 +03:00
|
|
|
find $MANDIR \( -type f -or -type l \) -name '*.[0-9]*' -print > $LIST
|
|
|
|
|
|
|
|
egrep '\.0$' $LIST | while read file
|
1993-12-21 06:28:00 +03:00
|
|
|
do
|
|
|
|
sed -n -f /usr/share/man/makewhatis.sed $file;
|
1997-11-01 18:06:09 +03:00
|
|
|
done > $TMP
|
1994-03-19 11:09:16 +03:00
|
|
|
|
1997-11-01 18:06:09 +03:00
|
|
|
egrep '\.[1-9]$|\.[1-9]?$' $LIST | xargs /usr/libexec/getNAME | \
|
|
|
|
sed -e 's/ [a-zA-Z0-9]* \\-/ -/' >> $TMP
|
1997-08-04 07:01:59 +04:00
|
|
|
|
1994-03-19 11:09:16 +03:00
|
|
|
|
1997-11-01 18:06:09 +03:00
|
|
|
egrep '\.[0].(gz|Z)$' $LIST | while read file
|
1994-03-19 11:09:16 +03:00
|
|
|
do
|
1997-08-04 07:01:59 +04:00
|
|
|
gzip -fdc $file | sed -n -f /usr/share/man/makewhatis.sed;
|
1997-11-01 18:06:09 +03:00
|
|
|
done >> $TMP
|
1994-03-19 11:09:16 +03:00
|
|
|
|
|
|
|
sort -u -o /tmp/whatis$$ /tmp/whatis$$
|
1993-12-21 06:28:00 +03:00
|
|
|
|
1994-02-07 08:11:24 +03:00
|
|
|
install -o bin -g bin -m 444 /tmp/whatis$$ "$MANDIR/whatis.db"
|
1993-12-21 06:28:00 +03:00
|
|
|
exit 0
|