#!/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'], 'unknown', ['/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); $lookup_ext = "unknown"; if (defined ($icons{$ext})) { $lookup_ext = $ext; } if (!$noexec) { print "
\"[$icons{$lookup_ext}[1]]\""; print "Run it: $_\n"; } if (!($ext =~ /^cgi$/)) { if ($ext =~ /^html$/i) { print "
\"[$icons{$lookup_ext}[1]]\""; } else { print "
\"[TEXT]\""; } print "See it: $_\n"; print "
\n"; } } } print < END ;