#!/bin/sh

MAIN_CLASS=cdac.medinfo.sdk.dcm30_04.services.cservices.tools.cgetscu.CGet_SCU
MAIN_JAR=cget_scu_tool30_04.jar

DIRNAME=`dirname $0`

# OS specific support (must be 'true' or 'false').
cygwin=false;
case "`uname`" in
    CYGWIN*)
        cygwin=true
        ;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
    [ -n "$JAVA_HOME" ] &&
        JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Setup the JVM
if [ "x$JAVA_HOME" != "x" ]; then
    JAVA=$JAVA_HOME/bin/java
else
    JAVA="java"
fi

# Derby Home
if [ "x$DERBY_HOME" != "x" ]; then
    CP="$CP:$DERBY_HOME/lib/derby.jar";
    CP="$CP:$DERBY_HOME/lib/derbyclient.jar";
fi

# Setup the classpath
CP="$CP:$MAIN_JAR"
CP="$CP:./../lib/DICOMBase30_04.jar"
CP="$CP:./../lib/DICOMNet30_04.jar"
CP="$CP:./../lib/DIMSECServices30_04.jar"
CP="$CP:./../lib/IOD30_04.jar"
CP="$CP:./../lib/commons-codec-1.3.jar";
CP="$CP:./../lib/en_US.jar";
CP="$CP:./../lib/derby.jar";
CP="$CP:./../lib/derbyclient.jar";

# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
    JAVA=`cygpath --path --windows "$JAVA"`
    CP=`cygpath --path --windows "$CP"`
fi

# Execute the JVM
exec $JAVA $JAVA_OPTS -cp $CP $MAIN_CLASS "$@"
