Commit | Line | Data |
---|---|---|
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 | ||
10 | trap "rm -f /tmp/whatisx.$$ /tmp/whatis$$; exit 1" 1 2 13 15 | |
11 | MANDIR=${1-/usr/man} | |
12 | rm -f /tmp/whatisx.$$ /tmp/whatis$$ | |
13 | if test ! -d $MANDIR ; then exit 0 ; fi | |
14 | cd $MANDIR | |
15 | top=`pwd` | |
16 | for i in man1 man2 man3 man4 man5 man6 man7 man8 mann manl | |
fedf4a33 | 17 | do |
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 | |
25 | done >/tmp/whatisx.$$ | |
26 | sed </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 | |
36 | chmod 664 whatis >/dev/null 2>&1 | |
37 | rm -f /tmp/whatisx.$$ /tmp/whatis$$ | |
38 | exit 0 |