#!/bin/sh -f
#
# support.sh - script used to run support commands located in the 
#              support directory.
#
#pragma ident "@(#)support.sh	1.2 99/04/16 Sun Microsystems, Inc."

PATH=/opt/SUNWicg/SunScreen/support:$PATH

USAGE="ssadm lib/support <command>\nRun: \"ssadm lib/support help\" for more information"

ARGS=""
SPACE=" "

# Check to see if user gave command or report usage
if [ $# -ne 0 ] 
then

  if [ $1 = "-u" ]
  then
    echo $USAGE  # Report usage
    exit 0
  fi
  COMMAND_NAME=$1
  shift

  while [ "$#" -ge 1 ]
  do
    ARGS=${ARGS}${SPACE}$1
    shift
  done

else
    echo $USAGE
    exit 2
fi

# check for existence of command
if [ ! -f /opt/SUNWicg/SunScreen/support/$COMMAND_NAME ]
then
    echo $USAGE
    exit 3
fi

# run command

/opt/SUNWicg/SunScreen/support/$COMMAND_NAME $ARGS
