#!@PERL@
#
# Directory list CGI by Hironori Sakamoto (hsaka@mth.biglobe.ne.jp)
#
if ( $^O =~ /^(ms)?(dos|win(32|nt)?)/i ) {
$WIN32 = 1;
$CYGPATH = 1;
}
elsif ( $^O =~ /cygwin|os2/i ) {
$WIN32 = 1;
$CYGPATH = 0;
}
else {
$WIN32 = 0;
$CYGPATH = 0;
}
$RC_DIR = '@RC_DIR@';
$RC_DIR =~ s@^~/@$ENV{'HOME'}/@;
if ($CYGPATH) {
$RC_DIR = &cygwin_pathconv("$RC_DIR");
}
$CONFIG = "$RC_DIR/dirlist";
$CGI = $ENV{'SCRIPT_NAME'} || $0;
$CGI = "file://" . &file_encode("$CGI");
$AFMT = '%s';
$NOW = time();
@OPT = &init_option($CONFIG);
$query = $ENV{'QUERY_STRING'};
$dir = '';
$cmd = '';
$cookie = '';
# $cgi = 0;
# if ($query eq '') {
# $_ = `pwd`; # insecure?
# chop;
# s/\r$//;
# $dir = $_;
# $cgi = 0;
# } elsif ($query =~ /^(opt\d+|dir|cmd|cookie)=/) {
foreach(split(/\&/, $query)) {
if (s/^dir=//) {
$dir = &form_decode($_);
} elsif (s/^opt(\d+)=//) {
$OPT[$1] = $_;
} elsif (s/^cmd=//) {
$cmd = $_;
} elsif (s/^cookie=//) {
$cookie = &form_decode($_);
}
}
if (($cookie eq "") || ($cookie ne $ENV{"LOCAL_COOKIE"})) {
print <
Directory list of $qdir
$qdir: $! !