Sync usage with man page.
[netbsd-mini2440.git] / share / man / tools / mklinks
blob3f7fb7c9e02e2dd5a03e41fa358aeeea6cb2f06e
1 set x $*
2 . ./.param
4 for dir in $DIRLST
5 do
6         cd $MANDIR/man$dir
7         for file in $FILLST
8         do
9                 so=`line < $file | sed "s/ .*//"`
10                 if test "$so" = ".so"
11                 then
12                         continue
13                 else
14                         ed - $file > $TMPDIR/tmp.$$ <<!
15                                 /^\.SH NAME/+s/ .-.*//p
16                                 q
18                         name=`line < $TMPDIR/tmp.$$`
19                         echo $name | grep "," > /dev/null
20                         if test $? -eq 0
21                         then
22                                 name=`echo $name | sed "s/,/ /g"`
23                                 for ent in $name
24                                 do
25                                         if test $ent = `echo $file | sed "s/\..*//"`
26                                         then
27                                                 continue
28                                         fi
29                                         suf=`echo $file | sed "s/.*\.\(.\{1,2\}\)\$/\1/"`
30                                         if test ! -f $ent.$suf
31                                         then
32                                                 cat > $ent.$suf <<!
33 .so $MANDIR/man$dir/$file
35                                         fi
36                                 done
37                         fi
38                 fi
39         done
41         rm -f tmp.$$
42 done