]> git.plutz.net Git - lobster/commitdiff
allow directory modules
authorPaul Hänsch <paul@plutz.net>
Tue, 7 Jan 2020 14:57:53 +0000 (15:57 +0100)
committerPaul Hänsch <paul@plutz.net>
Tue, 7 Jan 2020 14:57:53 +0000 (15:57 +0100)
index.cgi

index d4e3cb9c447d146b43dee193c743e28bdfb0913b..b52ba72723f7021d10dd66a96dfa20ef137aba63 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -2,7 +2,7 @@
 
 for n in "$@"; do case ${n%%=*} in
   data) _DATA="${n#data=}";;
-  exec) _exec="${n#exec=}";;
+  exec) _EXEC="${n#exec=}";;
   noerr) exec 2>&-;;
 esac; done
 
@@ -51,7 +51,12 @@ yield_page() {
   | "${_EXEC}/cgilite/html-sh.sed"
 }
 
-if   [   -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}/index.cgi" ]; then
+topdir="${_PATH#/}"
+topdir="/${topdir%%/*}"
+
+if   [   -d "${_EXEC}/${topdir}" -a -x "${_EXEC}/${topdir}/index.cgi" ]; then
+  . "${_EXEC}/${topdir}/index.cgi"
+elif   [   -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}/index.cgi" ]; then
   . "${_EXEC}/${_PATH}/index.cgi"
 elif [ ! -d "${_EXEC}/${_PATH}" -a -x "${_EXEC}/${_PATH}" ]; then
   . "${_EXEC}/${_PATH}"