#!/bin/sh
#---------------------------------------------------------
#	Check $DISPLAY variable
#---------------------------------------------------------
if [ $DISPLAY ]
then
	echo "Display is $DISPLAY"
else
	echo ""
	echo "DISPLAY environment variable is not defined !"
	echo "Please, enter your DISPLAY name."
	read answer
	if [ $answer ]
	then
#		get the end of string to know if ":0" has been set
		start=`expr $answer : '.*:' \| $answer`
		echo "$start "
		if [ $start = $answer ]
		then
			DISPLAY=$answer:0
		else
			DISPLAY=$answer
		fi
		export DISPLAY
		echo "Starting astor on $DISPLAY"
	else
		echo "DISPLAY is not defined ! Astor cannot start !"
		exit
	fi
fi

#---------------------------------------------------------
#	Add Doc path to $PATH (depends on OS used)
#---------------------------------------------------------
TANGO_HOME=/usr;		export TANGO_HOME
MY_OS=`uname`
export MY_OS

CPP_DOC=/usr/bin/doxygen
#---------------------------------------------------------
#	Set the template path
#---------------------------------------------------------
TEMPLATES=/usr/share/pogo/templates
export TEMPLATES

#---------------------------------------------------------
#	Set the Home Source Path
#---------------------------------------------------------
SRC_PATH=../generated
export SRC_PATH

#---------------------------------------------------------
#	Set the Class Path for Tango and pogo usage
#---------------------------------------------------------
APP_DIR=/usr/share/java;			export APP_DIR
PREF_DIR=/usr/share/pogo/preferences;   export PREF_DIR

POGO_CLASS=$APP_DIR/org.tango.pogo.jar;		export POGO_CLASS

CLASSPATH=$PREF_DIR:$POGO_CLASS;    export CLASSPATH

#---------------------------------------------------------
#	Start the Pogo process
#---------------------------------------------------------
echo "Starting Pogo Appli under $MY_OS.  "
#

/usr/bin/java -DTEMPL_HOME=$TEMPLATES		\
		-DCPP_DOC_PATH=$CPP_DOC		\
		-DIN_LANG=$POGO_LANG		\
		-DEDITOR=$POGO_EDITOR 		\
		-Dfile.encoding=ISO-8859-1 	\
		org.tango.pogo.pogo_gui.Pogo $*
