OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / freeswan / doc / utils / mkhtmlman
1 #!/bin/sh
2 # gathers manpages up into dir, converts them to HTML, including interlinking
3 # Assumes RedHat6.0 man2html available.
4
5 PATH=/usr/local/bin:/bin:/usr/bin:/usr/contrib/bin ; export PATH
6
7 case $# in
8 1)      exit 0  ;;
9 0)      echo "Usage: $0 destdir manpage ..." >&2 ; exit 1       ;;
10 esac
11
12 dir=$1
13 shift
14 mkdir -p $dir
15 rm -f $dir/*
16
17 for f
18 do
19         b=`basename $f`
20         case $b in
21         ipsec*)                 ;;      # ipsec.8, ipsec.conf.5, etc.
22         *)      b="ipsec_$b"    ;;
23         esac
24         cp $f $dir/$b
25         ../utils/manlink $dir $b
26 done
27
28 # build the html (sed mess fixes overly-smart man2html's crud)
29 refpat='"http://localhost/cgi-bin/man/man2html?\([1-8]\)+\([^"]*\)"'
30 for f in $dir/*.[1-8]
31 do
32         man2html $f | sed 's;'"$refpat"';"\2.\1.html";g' >$f.html
33 done
34
35 # remove the source files (must wait until after all builds, due to symlinks)
36 rm -f $dir/*.[1-8]