summaryrefslogtreecommitdiff
path: root/doc/utils/man2html.script
blob: 515911c815e6f17db50951f363a10e0b08cd44da (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
#!/bin/sh

# Assumes man2html command in path
# That is a Perl script downloadable from
# http://www.oac.uci.edu/indiv/ehood/man2html.html

# also uses our man_xref utility

case $# in
2)	;;
*)	echo "Usage: $0 mantree destdir" >&2 ; exit 2	;;
esac

mkdir -p $2
rm -f $2/*

# handle all sections just in case
# only 3 5 8 expected 
for i in `find $1 -name 'ipsec*.[1-9]'`
do
	b=`basename $i`
	# then parse that into section number s
	# and name n
	case $b in
		*.1)	s=1 ;;
		*.2)	s=2 ;;
		*.3)	s=3 ;;
		*.4)	s=4 ;;
		*.5)	s=5 ;;
		*.6)	s=6 ;;
		*.7)	s=7 ;;
		*.8)	s=8 ;;
		*.9)	s=9 ;;
		*)	echo "$0 has lost its mind" ; exit 1 ;;
	esac
	n=`basename $b \.$s`
	# the echos are a kluge
	# without them, the first section head is not tagged
	(echo ; echo ; man $s $n ) | man2html > $2/$b.html
done
# man2html doesn't convert man page cross-references such as
# ipsec.conf(5) into HTML links
# So post-process to do that.
for i in $2/*.html
do
	../utils/man_xref $i > temp
	mv temp $i
done