Files
snmp-info/t/docmunge
Bill Fenner d460c5a473 Some of the links were broken since some pages used
TABLE ENTRIES and others used TABLE METHODS.  Since
README says TABLE METHODS, let's standardize on that.
2006-11-18 00:23:26 +00:00

36 lines
864 B
Perl
Executable File

#!/usr/bin/perl -i.bak
#
# [Re-]write POD to create cross-links between Required MIBs, GLOBALS
# and TABLE METHODS sections.
# This is a horrible jumble of heuristics, but works with
# all of the existing files. It has only one false positive: HP.pm's
# mention of an SNMP::Info version number.
#
$section = undef;
$waiting = 0;
while (<>) {
if (eof) {
$section = undef;
$waiting = 0;
}
if (/^=head(\d)/) {
$sl = $1;
if ($sl <= $level) {
$section = undef;
}
if (/(TABLE METHODS|GLOBALS|Required MIBs)/) {
$section = $1;
$level = $sl;
if ($section eq 'TABLE METHODS' || $section eq 'GLOBALS') {
$waiting = 1;
}
}
if ($waiting && /imported/i) {
$waiting = 0;
}
} elsif (defined($section) && !$waiting && /^[^=]/ && /SNMP::Info/) {
s,(?:L<)?(SNMP::Info[a-zA-Z0-9:]*)(?:/[^>]+)?(?:>)?,L<$1/"$section">,g;
}
print;
}