bin/isabelle-interface
author gagern
Wed, 27 Apr 2005 23:02:08 +0200
changeset 15864 cc1b4a289321
parent 15843 d5bd4a18ce70
child 15967 f9163c6f69d6
permissions -rwxr-xr-x
make symlink handling compatible with whitespaces

#!/usr/bin/env bash
#
# $Id$
# Author: Markus Wenzel, TU Muenchen
#
# Isabelle interface startup script.

if [ -L "$0" ]; then
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
  exec "$(cd "$(dirname "$0")"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
fi


## settings

PRG="$(basename "$0")"

ISABELLE_HOME="$(dirname "$0")/.."
. "$ISABELLE_HOME/lib/scripts/getsettings" || \
  { echo "$PRG probably not called from its original place!"; exit 2; }


## diagnostics

function fail()
{
  echo "$1" >&2
  exit 2
}


## main

case "$ISABELLE_INTERFACE" in
  none)
    INTERFACE="$ISABELLE"
    ;;
  */*)
    INTERFACE="$ISABELLE_INTERFACE"
    ;;
  *)
    INTERFACE="$ISABELLE_HOME/lib/scripts/isa-$ISABELLE_INTERFACE"
    ;;
esac

[ ! -x "$INTERFACE" ] && fail "Bad Isabelle interface: \"$ISABELLE_INTERFACE\""

exec "$INTERFACE" "$@"