#!/bin/sh
# -----------------------------------------------------------------------
# Main script for firing up SME client
# Usage: startup_client [options]
#
# options:
#
#	-d 	debug
#	-p	port
#	
# -----------------------------------------------------------------------

MORE_ARGS="yes"
DEBUG="0"
JAVA_RUN_ARGS=""
TOPIC="top"

if [ $# -gt 0 ] ; then

  if [ $1 = -h ] ; then
	echo "Usage: sme_docs [options]"
	echo "  options:"
	echo 
	echo "    -h              print usage help"
	echo "    -t <topic_id>   display page mapped by topic_id"
	echo "    -d <debugMode>  debug mode: ( 1:run debugger, 2:attach debugger manually )"
	echo "    -java <args>    additional args to java command"
	echo	
	exit 0
  fi

  while [ $MORE_ARGS = "yes" ] ; do
    MORE_ARGS="no"

    if [ $1 = "-d" ] ; then
      MORE_ARGS="yes"
      shift
      DEBUG="$1"
      shift
      echo "In debug mode:"
    fi


    if [ $1 = "-t" ] ; then
      MORE_ARGS="yes"
      shift
      JAVA_RUN_ARGS="$PORTAL_ARGS $1"
      shift
    fi

    if [ $1 = "-java" ] ; then
      MORE_ARGS="yes"
      shift
      JAVA_RUN_ARGS="$JAVA_RUN_ARGS $1"
      shift
    fi

    if [ $1 = "-v" ] ; then
      MORE_ARGS="yes"
      shift
      JAVA_RUN_ARGS="$JAVA_RUN_ARGS -verbose"
    fi


  done

fi		

APP_ARGS="-help $TOPIC"
export APP_ARGS
export JAVA_RUN_ARGS

sme_execute_class miiee.mml.ProjectHandler $DEBUG 

exit 0	