#!/bin/sh
#------------------------------------------------------------------------------
#
#  kpax: - wrapper program to execute kpax in a platform-independent way ...
#
#  Dave Ritchie 08/06/98 - 16/08/11 - copied from equivalent Hex script.
#
#------------------------------------------------------------------------------

# unset KPAX_ROOT

if [ -z "$KPAX_ROOT" ]; then

   cmd_name="`basename "$0"`"
   dir_name="`dirname "$0"`"

# echo "cmd_name = $cmd_name"
# echo "dir_name = $dir_name"

   KPAX_ROOT="`(cd $dir_name/.. ; pwd)`"
   export KPAX_ROOT

#   echo "kpax: guessing KPAX_ROOT = $KPAX_ROOT"
fi

if [ -z "$KPAX_VERSION" ]; then

   export KPAX_VERSION=5.0.2

#  echo "kpax: guessing KPAX_VERSION = $KPAX_VERSION"
fi

if [ -z "$KPAX_DATABASE" ]; then
 
   export KPAX_DATABASE=${KPAX_ROOT}/kpax_database

#   echo "kpax: guessing KPAX_DATABASE = $KPAX_DATABASE"
fi

exec "${KPAX_ROOT}/bin/run_kpax" kpax $*
