#!/bin/sh -f

unknown () {
    echo "This system $unamestr is not known to me."
    echo "Please report this problem to Hangul & Computer Co. Ltd."
    exit 1
}

binname=hwp_demo

run () {
    if [ "$HWPDIR" = "" ] ; then
        HWPDIR=/usr/hwpx; export HWPDIR
    fi
    binfile="$HWPDIR/bin/$binname$binext"
    if [ ! -f $binfile ] ; then
       binfile="$HWPDIR/demo_bin/$binname$binext"
       if [ ! -f $binfile ] ; then
     	 echo "$0: execution file for this OS does not exist."
	 exit 1
       fi
    fi
    exec $binfile $@
}

#
# for each platform
#
sunos4x () {
    binext="_sunos"
    run $@
}

solaris () {
    binext="_sunos"
    run $@
}

solarisx86 () {
    binext="_solx86"
    run $@
}

linux () {
    binext="_linux"
    run $@
}

sco () {
    binext="_sco"
    run $@
}

hpux () {
    binext="_hp"
    run $@
}

aix () {
    binext="_ibm"
    run $@
}

osf () {
    binext="_alpha"
    run $@
}

ultrix () {
    binext="_ultrix"
    run $@
}

sgi () {
    binext="_sgi"
    run $@
}

#

sunos () {
    revision=`uname -r`
    case $revision in
        5.*) arch=`uname -p`
    	     case $arch in
		i386) solarisx86 $@ ;;
		sparc) solaris $@ ;;
                *) unknown ;;
       	     esac ;;
        4.*) sunos4x $@ ;;
        *) unknown ;;
    esac
}

unamestr=`uname -a`

case $unamestr in
    SunOS*) sunos $@ ;;
    HP-UX*) hpux $@ ;;
    AIX*) aix $@ ;;
    OSF*) osf $@ ;;
    ULTRIX*) ultrix $@ ;;
    IRIX*) sgi $@ ;;
    Linux*) linux $@ ;;
    SCO*) sco $@ ;;
    *) unknown ;;
esac
