#!/usr/bin/perl

print "Content-type: text/html\n\n";

opendir(DIR,'.');
while($line = readdir(DIR))
{
        $filename{$line} = 'y';
}
print "<table border=1>";

foreach $line (sort keys %filename)
{
        next if ($line eq 'index.cgi'); #This program
        next if ($line eq '.' || $line eq '..');        #skip . and ..
        next if (substr($line,0,1) eq '.');     #Skip hidden files
        ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
               $atime,$mtime,$ctime,$blksize,$blocks)
                   = stat($line);
        next if ($size == 0);
        print "<tr>";
        print "<td><a href=\"$line\">$line</a></td>";
        $display_date = scalar localtime $mtime;

        print "<td>$size</td>";
        print "<td>$display_date</td>";
        print "</tr>";
}
print "</table>";

