#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
cgi_input
#cgi_dump
puts "Content-Type: text/html"
puts ""
set root [cgi_get dir]
set files [lsort [readdir -nocomplain $root]]
puts "
"
foreach dir $files {
set path "$root/$dir"
regsub -all -- {\/+} $path "/" path
if {![file isdirectory $path]} continue
puts -nonewline "- [cgi_quote_html $dir]
"
}
foreach file $files {
set path "$root/$file"
regsub -all -- {\/+} $path "/" path
if {[file isdirectory $path]} continue
set ext [file extension $file]
puts -nonewline "- "
puts -nonewline ""
puts -nonewline [cgi_quote_html $file]
puts "
"
}
puts "
"