| 1 |
#! /bin/sh |
| 2 |
# |
| 3 |
# $Id: manlink,v 1.8 2002/09/17 20:17:16 sam Exp $ |
| 4 |
# |
| 5 |
# make list of alternate names for manpages |
| 6 |
|
| 7 |
PATH=/bin:/usr/bin ; export PATH |
| 8 |
usage="$0 manpage ..." |
| 9 |
|
| 10 |
for m |
| 11 |
do |
| 12 |
bm=`basename $m` |
| 13 |
if test ! -f $m |
| 14 |
then |
| 15 |
echo "$0: cannot find \`$m'" >&2 |
| 16 |
exit 1 |
| 17 |
fi |
| 18 |
suf=$(expr $bm : '.*\([.][^.][^.]*\)$') |
| 19 |
|
| 20 |
# a .\"+ line rules |
| 21 |
them=$(awk '/^\.\\"\+[ ]/ { for (i = 2; i <= NF; i++) print $i }' $m) |
| 22 |
|
| 23 |
# otherwise, try to intuit the list of names from the NAME section |
| 24 |
if test " $them" = " " |
| 25 |
then |
| 26 |
them=$( awk '/^\.SH[ \t]+NAME/,/^\.SH[ \t]+[^N]/' $m | |
| 27 |
grep -v '^\.' | tr ' ,' ' ' | |
| 28 |
sed -n '/ *\\*- *.*/s///p' | tr -s ' ' '\012' | |
| 29 |
grep -v '^ipsec$' ) |
| 30 |
fi |
| 31 |
|
| 32 |
# do it |
| 33 |
for f in $them |
| 34 |
do |
| 35 |
case $f in |
| 36 |
ipsec*) ff="$f" ;; # ipsec.8, ipsec.conf.5, etc. |
| 37 |
*) ff="ipsec_$f" ;; |
| 38 |
esac |
| 39 |
case $ff in |
| 40 |
*.[1-8]) ;; |
| 41 |
*) ff="$ff$suf" ;; |
| 42 |
esac |
| 43 |
#echo "Q: $bm FF: $ff" >&2 |
| 44 |
if [ " $ff" != " $bm" ] && [ " $ff" != " ipsec_$bm" ] |
| 45 |
then |
| 46 |
echo $bm $ff |
| 47 |
fi |
| 48 |
done |
| 49 |
done |
| 50 |
|
| 51 |
# |
| 52 |
# $Log: manlink,v $ |
| 53 |
# Revision 1.8 2002/09/17 20:17:16 sam |
| 54 |
# |
| 55 |
# The "make doc" fix broke "make install" silently; some man page symlinks |
| 56 |
# were being linked incorrectly. This resulted in files which passed the make |
| 57 |
# install test but linked to nothing. |
| 58 |
# |
| 59 |
# Revision 1.7 2002/08/07 06:23:35 sam |
| 60 |
# |
| 61 |
# freeswan/packaging/utils/manlink |
| 62 |
# |
| 63 |
# Revision 1.6 2002/05/06 21:20:24 mcr |
| 64 |
# manlink -n idea is a fail. It depended upon being able to |
| 65 |
# read the man page at the installed location, which isn't going |
| 66 |
# to work consistently. manlink now just generates a list of links |
| 67 |
# that should be made, leaving the Makefile script to decide what |
| 68 |
# to do with them. Further, it now processes the files found in the |
| 69 |
# repository, rather than the ones installed. |
| 70 |
# |
| 71 |
# |