#   	Patch output of man2html translation of manual page
#   	to fix infelicitous results.

#   	Copies Perl standard input (<>) to standard output;
#   	redirect as appropriate.

    $state = 0;     	    # Waiting for start of HTML
    
    while ($l = <>) {
    	$l =~ s/\s*$//;
	
	if ($state == 0) {
	    if (!($l =~ m/<HTML>/)) {
	    	next;
	    }
	    $state = 1;
	}
	
	if ($l =~ m-</TITLE>-) {
    	}
	
	if ($l =~ m/>Return to Main Contents</) {
	    $l = '<HR>';
	}
	
	if ($l =~ m-<H1>[^<]*</H1>-) {
	    $l = "<center>$l</center>";
	}
	
	if ($l =~ m=/cgi-bin/man/man2html=) {
	    $l =~ s/<A HREF=[^>]*>//;
	    $l =~ s-</A>--;
	}
	
	if ($l =~ m-<BODY>-) {
	    $l =~ s/<BODY>/<BODY bgcolor=\"\#FFFFFF\">/;
    	}	
	
	if ($l =~ m-</BODY>-) {
	    print("</div>\n");
	    print("<h3><a href=\"./\">Back to Annoyance Filter</a></h3>\n");
	    print("<h3><a href=\"http://www.fourmilab.ch/\">Fourmilab Home Page</a></h3>\n");
    	}
	
	$l =~ s/    / &nbsp; &nbsp; /g;
	
	print("$l\n");
	
	#   Post line output processing
	
	
	if ($l =~ m-</TITLE>-) {
	    print << "EOF";
<style type="text/css">
    DIV.bodycopy {
        margin-left: 15%;
        margin-right: 10%
    }
</style>
<meta name="keywords" content="annoyance, filter, manual, page, unix, man">
<meta name="description" content="Annoyance Filter Manual Page">
<meta name="author" content="John Walker">
<meta name="robots" content="noindex">
EOF
    	}
	
	if ($l =~ m/<BODY /) {
	    print("<div class=bodycopy>\n");
	}

    }


syntax highlighted by Code2HTML, v. 0.9.1