#!/usr/bin/perl -w
$TOCHEADER=" TABLE OF CONTENTS";
open(O, ">FAQ.html");
print O "
NET-SNMP FAQ
Table of Contents
\n";
while(<>) {
last if (/$TOCHEADER/);
}
while(<>) {
last if (/^\s*$/);
chomp();
if (/^ */) {
# continuation of the question.
print O "$_\n";
next;
}
$_ =~ s/^ *//;
$x = $_;
$x =~ s/^ *//g;
$x =~ s/[^a-zA-Z]/_/g;
$xlate{$_} = $x;
if (/^[ A-Z]+$/) {
print O "$_\n";
} else {
print O "- $_\n";
}
}
print O "
\n";
while(<>) {
$y = $_;
chomp($y);
if (defined($xlate{$y})) {
print O "\n";
}
print O $_;
}
$dt = localtime(time());
print O "
Last modified: $dt\n";