--exec=*) _EXEC="${cgilite_arg#*=}";;
--data=*) _DATA="${cgilite_arg#*=}";;
--base=*) _BASE="${cgilite_arg#*=}";;
+ --debug=*) DEBUG="${cgilite_arg#*=}";;
esac; done
unset cgilite_arg
_EXEC="${_EXEC%/}" _DATA="${_DATA%/}" _BASE="${_BASE%/}"
export _EXEC _DATA _BASE
+[ -n "$DEBUG" ] && exec 2>"${DEBUG}"
# Carriage Return and Line Break characters for convenience
CR="\r"
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