#!/bin/ksh
#
# @(#)src/rmi-iiop/misc/sov/ibm_bin/idlj.ksh, orb, orb131, 20020222 1.1.1.1
#
#==============================================================================
# Licensed Materials - Property of IBM
# "Restricted Materials of IBM"
# IBM Java(tm)2 SDK, Standard Edition, v 1.4
#
# (C) Copyright IBM Corp. 2001, 2002. All Rights Reserved
#
#==============================================================================
#
# idlj script which uses the IBM IDL compiler
#

PRG=$(whence $0) >/dev/null 2>&1

# Resolve symbolic links
while [[ -L "$PRG" ]]
do
    src=$(/usr/bin/ls -l $PRG | /usr/bin/awk '{print $NF}')
    print $src | /usr/bin/grep -q '^/'
    if [[ $? = 1 ]]
    then
	PRG=${PRG%/*}/$src
    else
	PRG=$src
    fi
done
APPHOME=$(""cd ${PRG%/*}/..; /usr/bin/pwd)

# Sort out the java options from the idlj options
java_args=
idlj_args=
while [[ $# > 0 ]]
do
    arg="${1#-J}"
    if [[ "$arg" = "$1" ]]
    then
	idlj_args="$idlj_args $arg"
    else
	java_args="$java_args $arg"
    fi
    shift
done

# Invoke the IBM IDL compiler
$APPHOME/bin/java $java_args -classpath "$APPHOME/lib/ibmtools.jar" com.ibm.idl.toJavaPortable.Compile $idlj_args
