#!/usr/bin/perl
########################################################
#
# Written for OSX GNU - /info directory
# at http://www.osxgnu.org/info/
# created on February 6th 2002
# by -Sx- IUDICIUM ( sneex@mac.com )
#
########################################################
use CGI;
use CGI::Carp qw/fatalsToBrowser/;
$cgi = CGI::new();
$script = $cgi->url;
print $cgi->header();
print<<__EOHEADER;
OSX GNU /info
These are the current available Info files:
__EOHEADER
opendir TARGETDIR, "." or die "FATAL ERROR: OSX GNU /info - Directory Missing: $!";
my @allfiles =grep !/^\./, readdir TARGETDIR;
closedir TARGETDIR;
for (@allfiles) {
chomp; # no newline...
s/^\s+//; # no leading whitespace...
s/\s+$//; # no trailing whitespace...
next unless length; # anything to process?
next unless /\.(htm|html)$/i;
$file = $_; $x++; # Count number of HTML files found...
open (IOFILE, $file) or die "Error $! processing $file";
while() {
chomp; # no newline...
s/^\s+//; # no leading whitespace...
s/\s+$//; # no trailing whitespace...
next unless length; # anything to process?
m/(\)(.+)(\<\/TITLE\>)/ig;
$title = $2;
last if m/| $title |
__EOTD
close (IOFILE) or die "error $! while closing $file";
# reset...
$file = '';
$title = '';
}
print<<__EOTAILER;
__EOTAILER
__END__