BSD 4_3 release
[unix-history] / usr / lib / makewhatis
CommitLineData
95f51977
C
1#!/bin/sh -
2#
3# Copyright (c) 1980 Regents of the University of California.
4# All rights reserved. The Berkeley software License Agreement
5# specifies the terms and conditions for redistribution.
6#
7# @(#)makewhatis.sh 5.3 (Berkeley) 3/29/86
8#
9
10trap "rm -f /tmp/whatisx.$$ /tmp/whatis$$; exit 1" 1 2 13 15
11MANDIR=${1-/usr/man}
12rm -f /tmp/whatisx.$$ /tmp/whatis$$
13if test ! -d $MANDIR ; then exit 0 ; fi
14cd $MANDIR
15top=`pwd`
16for i in man1 man2 man3 man4 man5 man6 man7 man8 mann manl
fedf4a33 17do
95f51977
C
18 if [ -d $i ] ; then
19 cd $i
20 if test "`echo *.*`" != "*.*" ; then
21 /usr/lib/getNAME *.*
22 fi
23 cd $top
24 fi
25done >/tmp/whatisx.$$
26sed </tmp/whatisx.$$ >/tmp/whatis$$ \
27 -e 's/\\-/-/' \
28 -e 's/\\\*-/-/' \
29 -e 's/ VAX-11//' \
30 -e 's/\\f[PRIB0123]//g' \
31 -e 's/\\s[-+0-9]*//g' \
32 -e 's/.TH [^ ]* \([^ ]*\).* \([^-]*\)/\2(\1) /' \
33 -e 's/ / /g'
34/usr/ucb/expand -24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100 \
35 /tmp/whatis$$ | sort | /usr/ucb/unexpand -a > whatis
36chmod 664 whatis >/dev/null 2>&1
37rm -f /tmp/whatisx.$$ /tmp/whatis$$
38exit 0