# Common shell routines for Java launcher scripts

## AddToClasspath
# Adds the list of specified names
# to the CLASSPATH environment variable.
# Names can be absolute or relative; if a relative name is specified, it is
# prefixed with the system Java library directory.
# Only the names that exist as files or directories will
# be added.
#
AddToClasspath() {
    local javalibdir=@JAVADIR@

    for p in "$@"; do
	case "$p" in
	    /*) ;;
	    *)  p=$javalibdir/$p ;;
	esac
	if [ ! -e "$p" ]; then
	    continue
	fi
	if [ -n "$CLASSPATH" ]; then
	    CLASSPATH=$CLASSPATH:$p
	else
	    CLASSPATH=$p
	    export CLASSPATH
	fi
    done
}
