From: Paul Hänsch Date: Tue, 7 Jan 2020 14:57:53 +0000 (+0100) Subject: allow directory modules X-Git-Url: https://git.plutz.net/?a=commitdiff_plain;h=88f480fb0141fcbff7ad1097341a0cbf1d48b1d1;p=lobster allow directory modules --- diff --git a/index.cgi b/index.cgi index d4e3cb9..b52ba72 100755 --- 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}"