#!/bin/sh
#
# %W% %E%
#
# Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#

#
# Startup script for the HTML Converter
#

PRG=$0
BINDIR=`dirname $0`
BINDIR=`cd $BINDIR; pwd`


# Test if HtmlConverter is a link
# SGI use -l

OS=`uname -s`

if [ "${OS}" = "Linux" ]
then
    LINKTEST="-L"
else
    LINKTEST="-h"
fi

if [ "${LINKTEST}" "${PRG}" ]
then
	{
	# Follow the link
	LINK=`ls -ld "${PRG}" | awk '{print $NF}'`
	# See if it is an absolute or relative path.
	CHAR=`expr "${LINK}" : '\(.\).*'`
	if [ "${CHAR}" = "/" ]
	then
		{
		BINDIR=`dirname "${LINK}"`
		BINDIR=`cd "${BINDIR}"; pwd`
		}
	else
		{
		BINDIR=`dirname "${BINDIR}/${LINK}"`
		BINDIR=`cd "${BINDIR}"; pwd`
		}
	fi
	}
fi

# Test path for jar file
if [ ! -f "${BINDIR}/../lib/htmlconverter.jar" ]
then
	exit 2
fi

# Execute the converter
${BINDIR}/java  -Xbootclasspath/a:${BINDIR}/../../jse-bin/lib/vm.jar:${BINDIR}/../../jse-bin/lib/jlm.jar:${BINDIR}/../../jse-bin/lib/ibmclasses.jar:${BINDIR}/../../jse-bin/lib/jsse.jar:${BINDIR}/../../jse-bin/classes:${BINDIR}/../jre/lib/vm.jar:${BINDIR}/../jre/lib/jlm.jar:${BINDIR}/../jre/lib/ibmclasses.jar:${BINDIR}/../jre/lib/jsse.jar:${BINDIR}/../jre/lib/rt.jar:${BINDIR}/../jre/lib/ibmpkcs.jar:${BINDIR}/../jre/lib/resources.jar  -jar ${BINDIR}/../lib/htmlconverter.jar $*
