#!/bin/ksh

#
#  %Z%%W% %I%
#  ===========================================================================
#  Licensed Materials - Property of IBM
#  "Restricted Materials of IBM"
# 
#  IBM Object Request Broker Edition, 2.00
#  (C) Copyright IBM Corp. 1998, 2013. All Rights Reserved
#  ===========================================================================

#
# tnameserv script for Hybrid platforms. Invokes the IBM implementation of
# the TransientNameServer.
#

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

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

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

# invoke IBM tnameserv implementation
$APPHOME/bin/java $java_args com.ibm.CosNaming.TransientNameServer $tnameserv_args
