bin/isabelle-interface
author kleing
Sun, 05 Oct 2008 13:13:48 +0200
changeset 28508 e8197ea2703b
parent 28502 6b0e3e4e1891
permissions -rwxr-xr-x
needs -b option for isabelle getenv

#!/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 "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
fi


## settings

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

ISABELLE_HOME="$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd ..; pwd)"
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2


## diagnostics

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


## main

case "$ISABELLE_INTERFACE" in
  none)
    INTERFACE="$ISABELLE_PROCESS"
    ;;
  */*)
    INTERFACE="$ISABELLE_INTERFACE"
    ;;
esac

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

exec "$INTERFACE" "$@"