man2html revision 1.1.1.2.10.1 1 #!/bin/sh
2
3 # Crude script to convert formatted manpages to HTML. Requires GROFF_NO_SGR.
4
5 while :
6 do
7 case $1 in
8 -t) title=$2; shift; shift;;
9 -*) echo "Usage: $0 [-t title] [file(s)]" 1>&2; exit 1;;
10 *) break;;
11 esac
12 done
13
14 echo "<!doctype html public \"-//W3C//DTD HTML 4.01 Transitional//EN\"
15 \"http://www.w3.org/TR/html4/loose.dtd\">
16 <html> <head>
17 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=us-ascii\">
18 <title> $title </title>
19 </head> <body> <pre>"
20
21 #ESC=`echo x | tr '[x]' '[\033]'`
22
23 sed '
24 s/\([<>&]\)\1/\1/g
25 s/&/\&/g
26 s/_</\</g
27 s/<</\</g
28 s/</\</g
29 s/_>/\>/g
30 s/>>/\>/g
31 s/>/\>/g
32 s;_\([^_]\);<i>\1</i>;g
33 s;.\(.\);<b>\1</b>;g
34
35 s;</i>\( *\)<i>;\1;g
36 s;</b>\( *\)<b>;\1;g
37
38 # Skip the redundant readme/html_directory blurb. The
39 # document names that follow will be hyperlinked.
40 /^<b>README FILES/{
41 h
42 N
43 N
44 g
45 }
46 ' "$@"
47
48 echo '</pre> </body> </html>'
49