-# basic functions
-debug() { #change to false to disable debugging
- if [ "$DBG_ENABLED" = true -a -n "$*" ]; then
- echo -E "$@" >>"$DBG_FILE"
- elif [ "$DBG_ENABLED" = true -a -z "$*" ]; then
- tee -a "$DBG_FILE"
- elif [ -z "$*" ]; then
- cat
- fi
-}
-
-die() {
- debug "$@"
- echo -E "$@" >>/dev/stderr
- exit 1
-}
-
-data_dirs(){
- # create directories for object storage
-
- [ -d "$_DATA" -a -w "$_DATA" ] || die "storage directory must be writable"
- for each in "$@"; do
- [ ! -e "$_DATA/$each" ] && mkdir "$_DATA/$each"
- [ -d "$_DATA/$each" -a -w "$_DATA/$each" ] || die "storage \"$_DATA/$each\" must be a writable directory"
- done
-}
-
-# create htaccess file
-[ -f "$_DATA/.htaccess" ] || cat >"$_DATA/.htaccess" <<EOF
-Options +ExecCGI
-AddHandler cgi-script .cgi
-DirectoryIndex index.cgi
-EOF
-[ -f "$_DATA/.htaccess" ] || die "no htaccess file present and unable to create one"
+if [ "$1" = '--server' -o "$1" = '--inetd' -o "$1" = '--ncat' ]; then
+ . "$_EXEC/shcgi/server.sh" $@
+else
+ HTTP_format(){ cat }
+fi