#!/bin/sh
#The REQUEST_URI environment variable value contains CGI executable and the
#script file. Its format is:
#   REQUEST_URI=/<cgi_executable>/<script_file>
#where:
#-the <cgi_executable> must be found through the PATH variable
#-the <script_file> is the path relative to the directory containing this file
CGI_EXECUTABLE=`echo $REQUEST_URI | cut -d/ -f2`
export SERVER_ROOT=$( dirname $0 )/
export SCRIPT_FILENAME=$SERVER_ROOT${REQUEST_URI#/*/}
ERR_FILE=`mktemp`
$CGI_EXECUTABLE $SCRIPT_FILENAME 2>$ERR_FILE
[ $? -eq 0 ] && exit 0
cat $ERR_FILE
exit 1
