#!/usr/bin/perl -w
# Look for the first <PRE>.
my $filename = $ARGV[0];
open(INFILE, "<$filename") || die "couldn't open input for reading: $!";
my $outfile = $filename;
$outfile =~ s/\.html$/.txt/;
open(OUTFILE, ">$outfile");
while (<INFILE> ne "<PRE>\n") {}
# Copy until closing PRE found, taking note of subject.
$lineno = 0;
while ($line = <INFILE>) {
$lineno++;
if ($lineno == 5) {
open(NAMES, ">>.names");
print NAMES "Path=./" . $outfile . "\n";
print NAMES "Name=$line\n\n";
}
if ($line =~ /^<\/PRE>$/) {
last;
}
print OUTFILE $line;
}
print OUTFILE <<'EOF';
-----------------------------------------------------------------
gopher://quux.org/ conversion by John Goerzen <
[email protected]>
of
http://communication.ucsd.edu/A-News/
This Usenet Oldnews Archive
article may be copied and distributed freely, provided:
1. There is no money collected for the text(s) of the articles.
2. The following notice remains appended to each copy:
The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.
EOF