#!/bin/sh
#
# copycgi
#
# copycgi cgibin_dir next_root
#
#
next_root=$2
cgibin_dir=$1
executable_ext=""
dll_ext=".dll"
cp="cp -p"

adaptor_dir=Library/WebObjects/Adaptors

cgi_adaptor="WebObjects"
isapi_adaptor="WebObjects-ISAPI"
nsapi_adaptor="WebObjects-NSAPI"

PATH=$2/Library/Executables\;$2/Developer/Executables/Utilities\;$PATH
export PATH
echo $PATH
sleep 2
set -x
mkdirs $cgibin_dir

if [ -f $next_root/$adaptor_dir/CGI/$cgi_adaptor.exe ]
then
	$cp $next_root/$adaptor_dir/CGI/$cgi_adaptor.exe $cgibin_dir
	$cp $next_root/$adaptor_dir/CGI/$cgi_adaptor.exe $cgibin_dir/$cgi_adaptor
fi

if [ -f $next_root/$adaptor_dir/ISAPI/$isapi_adaptor ]
then
	$cp $next_root/$adaptor_dir/ISAPI/$isapi_adaptor $cgibin_dir/$isapi_adaptor$dll_ext
fi

if [ -f $next_root/$adaptor_dir/NSAPI/$nsapi_adaptor ]
then
	$cp $next_root/$adaptor_dir/NSAPI/$nsapi_adaptor $cgibin_dir/$nsapi_adaptor$dll_ext
fi

