bin/isabelle-interface
author gagern
Wed Apr 20 14:18:33 2005 +0200 (2005-04-20)
changeset 15778 98af3693f6b3
parent 14981 e73f8140af78
child 15784 3a214de33d53
permissions -rwxr-xr-x
Allow symlinks to shell scripts
wenzelm@11550
     1
#!/usr/bin/env bash
wenzelm@11550
     2
#
wenzelm@11550
     3
# $Id$
wenzelm@11550
     4
# Author: Markus Wenzel, TU Muenchen
wenzelm@11550
     5
#
wenzelm@11550
     6
# Isabelle interface startup script.
wenzelm@11550
     7
wenzelm@11550
     8
wenzelm@11550
     9
## settings
wenzelm@11550
    10
wenzelm@11550
    11
PRG="$(basename "$0")"
wenzelm@11550
    12
gagern@15778
    13
THIS="$0"
gagern@15778
    14
while [ -L "$THIS" ]; do
gagern@15778
    15
    THIS="$(dirname "$THIS")/$(LC_ALL=C ls -l "$THIS" | sed 's/.* -> //')"
gagern@15778
    16
done
gagern@15778
    17
ISABELLE_HOME="$(cd "$(dirname "$(readlink -f "$THIS")")/.."; pwd)"
wenzelm@11550
    18
. "$ISABELLE_HOME/lib/scripts/getsettings" || \
wenzelm@11550
    19
  { echo "$PRG probably not called from its original place!"; exit 2; }
wenzelm@11550
    20
wenzelm@11550
    21
wenzelm@11550
    22
## diagnostics
wenzelm@11550
    23
wenzelm@11550
    24
function fail()
wenzelm@11550
    25
{
wenzelm@11550
    26
  echo "$1" >&2
wenzelm@11550
    27
  exit 2
wenzelm@11550
    28
}
wenzelm@11550
    29
wenzelm@11550
    30
wenzelm@11550
    31
## main
wenzelm@11550
    32
wenzelm@11550
    33
case "$ISABELLE_INTERFACE" in
wenzelm@11550
    34
  none)
wenzelm@11550
    35
    INTERFACE="$ISABELLE"
wenzelm@11550
    36
    ;;
wenzelm@11550
    37
  */*)
wenzelm@11550
    38
    INTERFACE="$ISABELLE_INTERFACE"
wenzelm@11550
    39
    ;;
wenzelm@11550
    40
  *)
wenzelm@11550
    41
    INTERFACE="$ISABELLE_HOME/lib/scripts/isa-$ISABELLE_INTERFACE"
wenzelm@11550
    42
    ;;
wenzelm@11550
    43
esac
wenzelm@11550
    44
wenzelm@11550
    45
[ ! -x "$INTERFACE" ] && fail "Bad Isabelle interface: \"$ISABELLE_INTERFACE\""
wenzelm@11550
    46
wenzelm@11550
    47
exec "$INTERFACE" "$@"