man2html revision 1.1.1.1 1 #!/bin/sh
2
3 # Crude script to convert formatted manual pages to HTML
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 sed '
22 s/\([<>&]\)\1/\1/g
23 s/&/\&/g
24 s/_</\</g
25 s/<</\</g
26 s/</\</g
27 s/_>/\>/g
28 s/>>/\>/g
29 s/>/\>/g
30 s;_\([^_]\);<i>\1</i>;g
31 s;.\(.\);<b>\1</b>;g
32 s;</i>\( *\)<i>;\1;g
33 s;</b>\( *\)<b>;\1;g
34 ' "$@" | egrep -v 'postconf (readme|html)_direc|tory</b>" *to *locate *this'
35
36 echo '</pre> </body> </html>'
37