#!/bin/ksh

# Component: modules
#
# Description:
#  Control script of wannabe standalone modules
#

#--- INIT ------------------------------
#needs $HOME
. $HOME/etc/ctrl.main.shi

[ -f $HOME/etc/setenv.sh ] && . $HOME/etc/setenv.sh

#--- FUNC ------------------------------
do_shell_()
{

	CTRL_DIR=`dirname $0 | xargs readlink -f`
	# extend classpath with modules: find modules directories and replace the new line characters with ":" in the list to make it classpath list format
	# escape CLASSPATH so it won't be substitute here but when the function is called
	cat <<-EndOfInlineData
		CLASSPATH=\$CLASSPATH:$(find $CTRL_DIR -name '*.jar' -exec echo -n {}: \;)
	EndOfInlineData

} #do_shell_()


#--- MAIN ------------------------------

check_action_ $1
if [ 0 = $? ]; then
  do_$1_ $2

else
  echo "--- Component modules [ctrl $$]: Bad command: $1" >&2
  exit 1

fi