#!/usr/bin/perl
local ($index) = "";
local ($line) = "";
local ($type) = "";
local ($user) = "";
local ($group) = "";
local ($size) = "";
local ($day) = "";
local ($name) = "";
local ($true_name) = "";
open (DIRECTORY_LISTING, "export LC_ALL=C ; ls -l --full-time --si |");
$index = "\
\
\
directory listing\
\
\
\
\
previous | .. | |
\
";
while ($line = )
{
if ($line =~ m/^(\S)\S+\s+\S+\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+\S+\s+\S+\s+(.+)$/)
{
$type = $1;
$user = $2;
$group = $3;
$size = $4;
$day = $5;
$name = $6;
if ($type eq "d")
{
$index = $index . "directory | \
$name/ | |
\n";
}
elsif ($type eq "l")
{
$name =~ m/^(\S+)\s+\-\>\s+(\S+)$/;
$true_name = $2;
$index = $index . "link | \
$name | |
\n";
}
else
{
$index = $index . "file | \
$name | $size |
\n";
}
}
}
$index = $index . "\
\
\
\
\
";
close (DIRECTORY_LISTING);
print ("Content-Type: text/html\n\n");
print ($index);