#!/bin/sh 
# Copyright 23 Jun 1996 Sun Microsystems, Inc. All Rights Reserved.
#pragma ident  "@(#)em	1.21 96/06/23 Sun Microsystems"

#
EM_PATH=/opt/SUNWconn/em
SYSTEMID=`uname -n`

EM_HOME="${EM_HOME-/opt/SUNWconn/em}"
GRAPHER_PATHNAME="${GRAPHER_PATHNAME:-/opt/SUNWconn/em/bin/em_grapher}"
export GRAPHER_PATHNAME
OPENWINHOME="${OPENWINHOME-/usr/openwin}"
PATH=$PATH:$EM_HOME/bin:$EM_HOME/etc:$EM_HOME/lib:/etc:/usr/bin/X11
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/openwin/lib:$EM_HOME/lib
SHLIB_PATH=$SHLIB_PATH:$EM_HOME/lib:/usr/lib/Motif1.2:/usr/lib/X11R5
export SHLIB_PATH
EM_MAPPATH="${EM_MAPPATH-$EM_HOME/mapdata}"
#
# REMIND - need to set this up to be edited by postinstall to put installdir in
#
# set up to look for applications
#
XFILESEARCHPATH=$XFILESEARCHPATH:/opt/SUNWconn/em/config/%N
#
# For I18N... put localized .ad files in lib/locale/<locale>/app-defaults, and use:
#XFILESEARCHPATH=$XFILESEARCHPATH:/opt/SUNWconn/em/lib/locale/%L/app-defaults/%N
#
export PATH EM_PATH SYSTEMID EM_HOME LD_LIBRARY_PATH XFILESEARCHPATH EM_MAPPATH TvFont TvFont2



#
# Error message function
#
err () {
	echo "`basename $0`:$@" 1>&2
	exit 1
}

# check if we have reasonable environment variable values before starting...
if [ ! -f ${EM_HOME}/bin/em_panel ]; then
        echo "EM_HOME is not set to the directory where SUNWemapp package was installed."
        echo "Please reset the EM_HOME environment variable, and retry."
        exit 1
fi


#
# Parse command line args.
#
while [ $# -gt 0 ]; do
	case "$1" in 
	-host)
		if [ $# -lt 2 ]; then
			err "$1 option requires a hostname"
		fi
		PANELOPT="-host $2"
		EM_SERVER=$2
		shift
		;;
	*)
		err "  Usage: em [-host <server>]\n\t-host <server> \t : MIS server"
		;;
	esac
	shift
done

export EM_SERVER
echo Starting em_panel $PANELOPT ...
em_panel ${PANELOPT}
