shithub: werc

Download patch

ref: e9c35127c7adf0d9db758a1732f60c405af0ffe3
parent: 9f734cf2e0c8a201c4c0e22d34c10d06eda88919
author: uriel <uriel@engel.se.cat-v.org>
date: Mon Oct 13 21:25:37 EDT 2008

Simplify dir listing code

--- a/bin/controller.rc
+++ b/bin/controller.rc
@@ -114,10 +114,10 @@
 }
 
 fn dir_listing_handler {
-    body = $1
-    echo '<h1 style="text-transform: capitalize;">' `{basename -d $body|sed -e 's,.*//,,g' -e 's,/$,,' -e 's,/, / ,g' } '</h1>'
+    d = `{basename -d $1}
+    echo '<h1 style="text-transform: capitalize;">' `{echo $d|sed -e 's,.*//,,g' -e 's,/$,,' -e 's,/, / ,g' } '</h1>'
     echo '<ul style="text-transform: capitalize;">'
-    ls -F `{ basename -d $body } | sed -e $dirfilter' s,^'$sitedir'/.*/([^$].*),<li><a href="\1">\1</a></li>,'
+    ls -F $d | sed -e $dirfilter' s,^'$sitedir'/.*/([^$].*),<li><a href="\1">\1</a></li>,'
     echo '</ul>'
 }