#!/usr/local/bin/perl
#Displays the current directory with information about each script.
%icons = ('cgi',['/icons/script.gif','CGI'],
'html',['/icons/layout.gif','HTML'],
'pl',['/icons/p.gif','PERL'],
'txt',['/icons/text.gif','TEXT'],
undef, ['/myicons/huh.gif', 'UNKNOWN']);
print <
Directory Listing of Scripts
HTML
;
$has_html=0;
foreach (<*>)
{
if(-f $_ && (-x $_ || /html$/) && /[^~\#]$/)
{
open FILE, $_;
($ext) = /\.([^.]*)$/;
$command = ;
$desc = ;
$exec = ;
$noexec = ($exec =~ /noexec/i);
($line) = $desc =~ /^#*(.*)/;
if ($ext =~ /^txt$/i) {
$noexec = 1;
$line = "";
}
close FILE;
print "
$line\n" if ($line);
if (!$noexec) {
print "
";
print "Run it: $_\n";
}
if (!($ext =~ /^cgi$/)) {
if ($ext =~ /^html$/i) {
print "
";
} else {
print "
";
}
print "See it: $_\n";
print "
\n";
}
}
}
print <
END
;