#!/bin/sh
# $Id: limaltool 255 2005-04-20 13:56:04Z mt $
#
# limaltool - Start a LiMaL tool from the LiMaL tool path
#
# Author: Stefan Hundhammer <sh@suse.de>
#         Stefan Schubert   <schubi@suse.de>
# (c) SuSE GmbH 2001
#

self=`basename $0`

if [ "$1" == "--prefix" -o "$1" == "-p" ]; then
    shift
    prefix="$1"
    shift
fi

# run the tools that are in the same prefix as we are
if [ -z "$prefix" ]; then
    if [ `dirname $0` == "." ]; then
	limaltoolpath=.
    else
	prefix=${0%/bin/$self}
	limaltoolpath=${prefix}/share/limal/devtools/bin
    fi
fi

cmd=$1
shift

if [ "$cmd" == "--help" ]; then
    cd $limaltoolpath
    ls
    exit 0
fi

if [ -z $cmd ]; then
    echo ""							>&2
    echo "Usage: ${self} [--prefix <prefix>] [--help] <command> [<arg> ...]">&2
    echo ""							>&2
    echo "Starts a LiMaL tool from '$limaltoolpath'."		>&2
    echo ""							>&2
    exit 1
fi


if [ -x $limaltoolpath/$cmd ]; then
    $limaltoolpath/$cmd "$@"
else
    echo "${self}: Can't find \"$cmd\" in $limaltoolpath"	>&2
    exit 1
fi
