# makewhatis -- update the whatis database in the man directories.
# Copyright (c) 1990, 1991, John W. Eaton.
# You may distribute under the terms of the GNU General Public
# License as specified in the README file that comes with the man
# Department of Chemical Engineering
# The University of Texas at Austin
PATH
=/bin
:/usr
/local
/bin
:/usr
/ucb
:/usr
/bin
echo "usage: makewhatis directory [...]"
for f
in `find $subdir -type f -print`
/^\.S[hH][ ]*NAME/,/^\.S[hH]/p' $f |\
awk 'BEGIN {insh = 0; inSh = 0; Nd = 0} {
if ($1 == ".TH" || $1 == ".Dt")
else if (($1 == ".br" && insh == 1)\
|| ($1 == ".SH" && insh == 1)\
|| ($1 == ".Sh" && inSh == 1)) {
for (k= 1; k <= nc; k++) {
namesect = sprintf("%s (%s)", name[k], sect)
for (j = 0; j < i-1; j++)
printf("%s\n", desc[i-1])
} else if ($1 == ".SH" && insh == 0) {
} else if ($1 == ".Sh" && inSh == 0) {
if (count == 1 && NF > 2) {
for (k = 1; k <= NF; k++)
for (j = start; j <= NF; j++)
for (j = 1; j <= NF; j++)
} else if ($1 == ".Nm" && inSh == 1 && Nd == 0) {
for (k = 2; k <= NF; k++) {
} else if ($1 == ".Nd" && inSh == 1) {
for (j = 2; j <= NF; j++)
for (j = start; j <= NF; j++)
done |
sort |
colrm 80 |
uniq > $dir/whatis.db.tmp
mv $dir/whatis.db.tmp
$dir/whatis