#!/usr/bin/perl
my $infile = shift @ARGV;
map { s/\.[0-9]$//; $pages{$_} = 1; } @ARGV;
open(I,$infile);
$first = 1;
print "
Net-SNMP manual pages
Other Net-SNMP Documantion
";
while () {
if (/^#\s*(.*)/) {
print "\n" if (!$first);
print "$1
\n\n";
$first = 0;
} else {
my $name = $_;
my $title;
chomp($name);
if (!exists($pages{$name})) {
print STDERR "$name is in $infile, but not in the rest of the args.\n";
}
open(H,"$name.html");
while () {
if (/(.*)<\/TITLE>/) {
$title = $1;
}
if (/NAME<\/H2>/) {
$_ = ;
while (/^\s*$/) {
$_ = ;
}
$title = $_;
chomp($title);
$title =~ s/\s*$name\s*-\s*//;
}
}
close(H);
print " | $name | $title |
\n";
delete $pages{$name};
}
}
print "
\n";
@left = keys(%pages);
if ($#left > -1) {
print STDERR "missing a filing location for: ",
join(", ", @left), "\n";
}