/usr/bin/xmlmantohtml is in xmltoman 0.4-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #!/usr/bin/perl
# xmlmanhtml - simple xml to man converter
# Copyright (C) 2000-2002 Oliver Kurth <oku@masqmail.cx>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
use XML::Parser;
my $section = "";
my %terminators = (
manpage => "</td></tr></table></center>\n",
synopsis => "</b>\n",
description => "\n",
options => "",
seealso => "\n",
section => "\n",
# option => "\n",
arg => "</em>",
file => "</em>",
opt => "</b>",
# optdesc => "\n",
cmd => "<br>\n",
p => "</p>"
);
sub flush_buf{
local $_;
print $buffer;
$buffer = "";
}
sub handle_start{
local $_;
my $expat = shift;
my $element = shift;
my %attr = @_;
flush_buf();
$_ = $element;
/^manpage$/ and do{
print "<center><table width=\"80%\">\n<tr><td>";
print "<h1>$attr{name}</h1>\n";
print "<h2>" . $attr{desc} . "</h2>\n";
};
/^synopsis$/ and do{
print "<h2>Synopsis</h2>\n<b>";
$section = $element;
};
/^description$/ and do{
print "<h2>Description</h2>\n";
$section = $element;
};
/^options$/ and do{
print "<h2>Options</h2>\n";
$section = $element;
};
/^seealso$/ and do{
print "<h2>see also</h2>\n";
$section = $element;
};
/^section$/ and do{
print "<h2>".$attr{name}."</h2>\n";
$section = $attr{name};
};
/^arg$/ and do{
print "<em>";
};
/^file$/ and do{
print "<em>";
};
/^opt$/ and do{
print "<b>";
$opt = 1;
};
/^manref$/ and do{
if(!$attr{href}){
print "<b>" . $attr{name} ." (" . $attr{section} . ")</b>";
}else{
print "<a href=\"$attr{href}\">" . $attr{name}. "</a>";
}
};
/^p$/ and do{
print "<p>";
# $paragraph = 1;
# $break = 1;
};
/^url$/ and do{
print "<a href = \"$attr{href}\">".$attr{href}."</a>";
};
}
sub handle_end{
local $_;
my $expat = shift;
my $element = shift;
flush_buf();
my %attr = @_;
$section = "" if($section eq $element);
print $terminators{$element} if($terminators{$element});
}
sub handle_char{
local $_;
my $expat = shift;
my $string = shift;
$string =~ s/&/&/gs;
$string =~ s/</</gs;
$string =~ s/>/>/gs;
$string =~ s/"/"/gs;
$buffer .= $string;
}
MAIN:{
my $file = shift;
if (!$file) {
print STDERR "You need to specify a file to parse\n";
exit(1);
}
my $parser = new XML::Parser(Handlers => {Start => \&handle_start,
End => \&handle_end,
Char => \&handle_char});
print '<body text="#000000" link="#0000ff" bgcolor="#ffffff">';
$parser->parsefile($file);
print "</body>\n";
}
|