#!/bin/sh
#
# Decodes and prints the components of a stringified IOR
#

resolve()
{
    CMD="$1"
    # test if CMD is a symlink or not
    while [ -h "$CMD" ] ; do
        link=`find "$CMD" -printf "%l\n"`
        if expr "$link" : '/.*' > /dev/null; then
            CMD="$link"
        else
            CMD=`dirname "$CMD"`"/$link"
        fi
    done
    echo $CMD;
}

case $0 in
    /*)
        _SELF="$0"
        ;;
    *)
        _SELF="`pwd`/$0"
        ;;
esac

_SELF=`resolve "$_SELF"`
_BIN_DIR_RAW=`dirname "$_SELF"`
_BIN_DIR_NORM=`cd "$_BIN_DIR_RAW" > /dev/null 2>&1; pwd`
RESOLVED_JACORB_HOME=`dirname "$_BIN_DIR_NORM"`


RESOLVED_JACO_CMD=${RESOLVED_JACORB_HOME}/bin/jaco


JACO_CMD=${RESOLVED_JACO_CMD}

$JACO_CMD org.jacorb.orb.util.PrintIOR "$@"
