#!/bin/sh
# Copyright (C) 2004-2014, International Business Machines Corporation
#  and others.  All Rights Reserved.

#
######################
##
## See documentation at: http://www.jtcsv.com/cgibin/cldrwiki.pl?CldrTools
##
######################
#
# To use: put this in your 'bin' dir,
# and symlink it to XMLValidator and LDML2ICUConverter
#


## Change the following if needed
# where icu4j lives (or other classes)
CLDRCLASSPATH=${HOME}/icu4j/icu4j.jar:${HOME}/icu4j/classes/
# the command to use with java (or empty for none)
CPCMD=
# how to run java
JAVA=${JAVA-java}

## Override the above settings in a ~/.cldrrc file if desired (+x)
# example:
#   CLDRCLASSPATH=${HOME}/J/icu4j/classes
if [ -x ${HOME}/.cldrrc ];
then
    . ${HOME}/.cldrrc
fi

if [ "x${CLDRCLASSPATH}" != "x" ];
then
  if [ "x${CPCMD}" = "x" ];
  then
      CPCMD="-classpath ${CLDRCLASSPATH}"
  fi
fi

# root name of this script
ME=`basename $0`

## no need to change below this line.
# base package
case $ME
in
    "XMLValidator") PKG=org.unicode.cldr.util;;
    "ShowLanguages") PKG=org.unicode.cldr.tool;;
    "LDML2ICUConverter") PKG=org.unicode.cldr.icu;;
    "ConsoleCheckCLDR") PKG=org.unicode.cldr.test;;
    "Ldml2JsonConverter") PKG=org.unicode.cldr.json;;
    *)  PKG=org.unicode.cldr.tool;;
esac

#error check
if [ $PKG = "UNKNOWN" ];
then
    echo "Unknown tool name $ME. Please set the package here.!"
    exit -1
fi


if [ $ME = "CLDRWrapper" ];
then
    echo "# $ME: Don't run this script directly."
    echo Symlink $0 to the names XMLValidator, LDML2ICUConverter, and other ${PKG} tools.
    exit 1
fi
exec ${JAVA} ${VM_OPTS} ${WRAPPER_OPTS} ${CWDEFS} ${CPCMD} ${PKG}.${ME} "$@"