shithub: misc

Download patch

ref: 93f3d43a2889287a96e003124ec61290c5bf80f6
parent: 204d030a6e6bb71cbc4cdf581b91c8c01242d656
author: qwx <qwx@sciops.net>
date: Thu Mar 4 08:54:02 EST 2021

add ls werc app from site

diff: cannot open b/werc/ls//null: file does not exist: 'b/werc/ls//null' diff: cannot open b/werc//null: file does not exist: 'b/werc//null'
--- /dev/null
+++ b/werc/ls/app.rc
@@ -1,0 +1,13 @@
+fn ls_init{
+	handler_body_main=(ls_body $req_path)
+}
+
+fn ls_body{
+	d=`{basename -d $1}
+	if(~ $#d 0)
+		d='/'
+	echo $d | sed 's,.*//,,g; s,/$,,; s,/, / ,g; s,.*,<h1 class="dir-list-head">&</h1> <ul class="dir-list">,'
+	echo '<a href="../">..</a><br><table border="0"><tr><th>size<th>last modified<th>name</tr>'
+	ls -Fl $sitedir$d | sed $dirclean'/_werc/d;s/^[^ ]+ [^ ]+ [^ ]+ [^ ]+ [^ ]+ +//;s/^([^ ]+) (.*) [^ ]+\/([^''\/\* ]+\/?)''?(\*?)$/<tr><td>\1<td>\2<td><a href="\3">\3\4<\/a><\/tr>/'
+	echo '</table></ul>'
+}