From 88f480fb0141fcbff7ad1097341a0cbf1d48b1d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 7 Jan 2020 15:57:53 +0100 Subject: [PATCH] allow directory modules --- index.cgi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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}" -- 2.39.2