#!/bin/rc PATH_INFO=`{echo $PATH_INFO | urlencode -d} full_path=$"FS_ROOT^$"PATH_INFO full_path=$"full_path if(! ~ `{cleanname -d$FS_ROOT $full_path} `{cleanname $FS_ROOT}^*){ error 503 exit } if(! test -d $full_path){ error 404 exit } if(! test -r $full_path){ error 503 exit } builtin cd $full_path if(~ $"NOINDEXFILE ^ $"NOINDEX ''){ ifile=index.htm* if(! ~ $ifile(1) *'*'){ PATH_INFO=$PATH_INFO^$ifile(1) exec serve-static } } title=`{echo $SITE_TITLE | sed s,%s,^$"PATH_INFO^,} title=$"title lso=() switch($2){ case size # ls has no option to sort by size # could pipe it through sort, I suppose case date lso=-t } do_log 200 echo 'HTTP/1.1 200 OK'^$cr emit_extra_headers echo 'Content-type: text/html; charset=utf-8'^$cr echo $cr echo '
"hrsize($6)" | " print ""$7" | " print ""$8" | " print ""$9" | " $1="" ; $2="" ; $3="" ; $4="" ; $5="" ; $6="" ; $7="" ; $8="" ; $9="" sub("^ *?", "") print ""$0" | " print "
" print " | "$7" | " print ""$8" | " print ""$9" | " $1="" ; $2="" ; $3="" ; $4="" ; $5="" ; $6="" ; $7="" ; $8="" ; $9="" sub("^ *?", "") print ""$0"/ | " print "