aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/utils/manlink
blob: 84e6031b2a4bea6e708d6800c57ae6fa4350cf51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /bin/sh
#
# $Id: manlink,v 1.1 2004/03/15 20:35:27 as Exp $
#
# make list of alternate names for manpages

PATH=/bin:/usr/bin ; export PATH
usage="$0 manpage ..."

for m
do
    bm=`basename $m`
	if test ! -f $m
	then
		echo "$0: cannot find \`$m'" >&2
		exit 1
	fi
	suf=$(expr $bm : '.*\([.][^.][^.]*\)$')

	# a .\"+ line rules
	them=$(awk '/^\.\\"\+[ 	]/ { for (i = 2; i <= NF; i++) print $i }' $m)

	# otherwise, try to intuit the list of names from the NAME section
	if test " $them" = " "
	then
		them=$(	awk '/^\.SH[ \t]+NAME/,/^\.SH[ \t]+[^N]/' $m |
			egrep -v '^\.' | tr '	,' '  ' |
			sed -n '/  *\\*-  *.*/s///p' | tr -s ' ' '\012' |
			egrep -v '^ipsec$' )
	fi

	# do it
	for f in $them
	do
		case $f in
		ipsec*)	ff="$f"		;;	# ipsec.8, ipsec.conf.5, etc.
		*)	ff="ipsec_$f"	;;
		esac
		case $ff in
		*.[1-8])			;;
		*)		ff="$ff$suf"	;;
		esac
		#echo "Q: $bm FF: $ff" >&2
		if [ " $ff" != " $bm" ] && [ " $ff" != " ipsec_$bm" ]
		then
   		    echo $bm $ff
		fi
	done
done

#
# $Log: manlink,v $
# Revision 1.1  2004/03/15 20:35:27  as
# added files from freeswan-2.04-x509-1.5.3
#
# Revision 1.8  2002/09/17 20:17:16  sam
#
# The "make doc" fix broke "make install" silently; some man page symlinks
# were being linked incorrectly. This resulted in files which passed the make
# install test but linked to nothing.
#
# Revision 1.7  2002/08/07 06:23:35  sam
#
#  	freeswan/packaging/utils/manlink
#
# Revision 1.6  2002/05/06 21:20:24  mcr
# 	manlink -n idea is a fail. It depended upon being able to
# 	read the man page at the installed location, which isn't going
# 	to work consistently. manlink now just generates a list of links
# 	that should be made, leaving the Makefile script to decide what
# 	to do with them. Further, it now processes the files found in the
# 	repository, rather than the ones installed.
#
#