From: Paul Hänsch Date: Wed, 14 Jan 2026 04:39:36 +0000 (+0100) Subject: add universal --debug option X-Git-Url: http://git.plutz.net/?a=commitdiff_plain;h=f144a78eb6d7bbe8904d31335af0a4f148774140;p=cgilite add universal --debug option --- diff --git a/cgilite.sh b/cgilite.sh index fc7953b..5e4ebbb 100755 --- a/cgilite.sh +++ b/cgilite.sh @@ -40,6 +40,7 @@ for cgilite_arg in "$@"; do case $cgilite_arg in --exec=*) _EXEC="${cgilite_arg#*=}";; --data=*) _DATA="${cgilite_arg#*=}";; --base=*) _BASE="${cgilite_arg#*=}";; + --debug=*) DEBUG="${cgilite_arg#*=}";; esac; done unset cgilite_arg @@ -48,6 +49,7 @@ _DATA="${_DATA:-${PWD:-.}}" _EXEC="${_EXEC%/}" _DATA="${_DATA%/}" _BASE="${_BASE%/}" export _EXEC _DATA _BASE +[ -n "$DEBUG" ] && exec 2>"${DEBUG}" # Carriage Return and Line Break characters for convenience CR=" " @@ -207,7 +209,7 @@ fi PATH_INFO="$(PATH "/${PATH_INFO#${_BASE}}")" -debug(){ [ $# -gt 0 ] && printf '%s\n' "$@" >&2 || tee -a /dev/stderr; } +debug(){ [ $# -gt 0 ] && printf '%s\n' "$@" >&2 || tee -a "${DEBUG:-/dev/stderr}"; } [ "${DEBUG+x}" ] && env >&2 # general helper functions, see GET, POST, and REF below