#!/bin/sh
############################################################################
#
# Name:
#	sysman
#
# Abstract:
#	Umbrella command line interface for several system management
#	components. 
#
# Notes:
#	This script is a simple wrapper for launching the SysMan Menu,
#	the SysMan Station, sysmancli, or sysman_clone using the following
#	command line arguments:
#	    -menu
#	    -station
#	    -clone
#	    -clu
#	If not argument is specified, then -menu is the default.
#	Any additional command line arguments are passed on. 
#
############################################################################

sysman_dir=${SYSMANDIR-/usr/share/sysman}

if [ $# -eq 0 ]			# If no command line arguments
then				# Then launch the menu
    exec $sysman_dir/menu/src/sysman_menu 
else				# Else at least one argument

    if [ "$1" = "-station" ]	# If we want SMS
    then 
		shift		# Nuke -station and pass the rest to SMS
		exec /usr/sbin/sms ${1+"$@"}

	 elif [ "$1" = "-cli" ]	# If we want sysmancli
    then
		shift		# Nuke -cli and pass the rest to sysmancli
		exec $sysman_dir/bin/sysmancli ${1+"$@"}

    elif [ "$1" = "-clone" ] # If we want sysman_clone
	 then
		shift		# Nuke -cli and pass the rest to sysmancli
		exec $sysman_dir/bin/sysman_clone ${1+"$@"}

    else			# Else we want the menu

	# The menu is used to display help on the overall sysman command
	# if the only argument is -h or -help or ?, then transform
	# that into -command_help. 

		if [ "$1" = "-h" -o "$1" = "-help" -o "$1" = "?" ]
		then
		    exec $sysman_dir/menu/src/sysman_menu -command_help
		else
		    exec $sysman_dir/menu/src/sysman_menu ${1+"$@"}
		fi 

    fi  

fi

