shithub: werc

Download patch

ref: 3bbe4cd657208807037ac3b86e164b3743813160
parent: 0ad15583db1d6bc6f7d23c6278c7ef51be42252a
author: uriel <uriel@engel.se.cat-v.org>
date: Sun Jan 25 23:51:06 EST 2009

Handle dir listing of site root.

--- a/bin/werc.rc
+++ b/bin/werc.rc
@@ -69,6 +69,8 @@
 
 fn dir_listing_handler {
     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">,'
     # Symlinks suck: '/.' forces ls to list the linked dir if $d is a symlink.
     ls -F $dir_listing_ls_opts $sitedir$d/. | sed $dirfilter$dirclean' s,.*/([^/]+/?)$,<li><a href="\1">\1</a></li>,'