#!inline #!/usr/bin/perl -w #use strict; use Fcntl ':mode'; (my $path=$ENV{SCRIPT_FILENAME})=~s![^/]*$!!; (my $uri=$ENV{SCRIPT_NAME})=~s!/[^/]*$!!; $uri="/" unless $uri; my $t="Index of $uri"; print "Content-Type: text/html\n\n"; print " $t

$t

";
(my $parent=$uri)=~s![^/]*$!!;
print qq!Parent Directory\n!;
foreach(<$path*>) {
	my $file=$_;
	my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
                      $atime,$mtime,$ctime,$blksize,$blocks)
                          = stat($file);
	s/^$path//;
	next if($_ eq "index.pl");
	if(S_ISDIR($mode)) {$_.="/"}
	printf(qq!%s%s %s %8i\n!,
	  $_,$_," "x(20-length($_)),scalar localtime($mtime),$size);
}
print "
\n";