OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / doc / utils / man2html.script
1 #!/bin/sh
2
3 # Assumes man2html command in path
4 # That is a Perl script downloadable from
5 # http://www.oac.uci.edu/indiv/ehood/man2html.html
6
7 # also uses our man_xref utility
8
9 case $# in
10 2)      ;;
11 *)      echo "Usage: $0 mantree destdir" >&2 ; exit 2   ;;
12 esac
13
14 mkdir -p $2
15 rm -f $2/*
16
17 # handle all sections just in case
18 # only 3 5 8 expected 
19 for i in `find $1 -name 'ipsec*.[1-9]'`
20 do
21         b=`basename $i`
22         # then parse that into section number s
23         # and name n
24         case $b in
25                 *.1)    s=1 ;;
26                 *.2)    s=2 ;;
27                 *.3)    s=3 ;;
28                 *.4)    s=4 ;;
29                 *.5)    s=5 ;;
30                 *.6)    s=6 ;;
31                 *.7)    s=7 ;;
32                 *.8)    s=8 ;;
33                 *.9)    s=9 ;;
34                 *)      echo "$0 has lost its mind" ; exit 1 ;;
35         esac
36         n=`basename $b \.$s`
37         # the echos are a kluge
38         # without them, the first section head is not tagged
39         (echo ; echo ; man $s $n ) | man2html > $2/$b.html
40 done
41 # man2html doesn't convert man page cross-references such as
42 # ipsec.conf(5) into HTML links
43 # So post-process to do that.
44 for i in $2/*.html
45 do
46         ../utils/man_xref $i > temp
47         mv temp $i
48 done