bin/isabelle-interface
author gagern
Wed Apr 27 23:02:08 2005 +0200 (2005-04-27)
changeset 15864 cc1b4a289321
parent 15843 d5bd4a18ce70
child 15967 f9163c6f69d6
permissions -rwxr-xr-x
make symlink handling compatible with whitespaces
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@15843
     8
if [ -L "$0" ]; then
wenzelm@15843
     9
  TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
gagern@15864
    10
  exec "$(cd "$(dirname "$0")"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
wenzelm@15843
    11
fi
wenzelm@15843
    12
wenzelm@11550
    13
wenzelm@11550
    14
## settings
wenzelm@11550
    15
wenzelm@11550
    16
PRG="$(basename "$0")"
wenzelm@11550
    17
wenzelm@15843
    18
ISABELLE_HOME="$(dirname "$0")/.."
wenzelm@11550
    19
. "$ISABELLE_HOME/lib/scripts/getsettings" || \
wenzelm@11550
    20
  { echo "$PRG probably not called from its original place!"; exit 2; }
wenzelm@11550
    21
wenzelm@11550
    22
wenzelm@11550
    23
## diagnostics
wenzelm@11550
    24
wenzelm@11550
    25
function fail()
wenzelm@11550
    26
{
wenzelm@11550
    27
  echo "$1" >&2
wenzelm@11550
    28
  exit 2
wenzelm@11550
    29
}
wenzelm@11550
    30
wenzelm@11550
    31
wenzelm@11550
    32
## main
wenzelm@11550
    33
wenzelm@11550
    34
case "$ISABELLE_INTERFACE" in
wenzelm@11550
    35
  none)
wenzelm@11550
    36
    INTERFACE="$ISABELLE"
wenzelm@11550
    37
    ;;
wenzelm@11550
    38
  */*)
wenzelm@11550
    39
    INTERFACE="$ISABELLE_INTERFACE"
wenzelm@11550
    40
    ;;
wenzelm@11550
    41
  *)
wenzelm@11550
    42
    INTERFACE="$ISABELLE_HOME/lib/scripts/isa-$ISABELLE_INTERFACE"
wenzelm@11550
    43
    ;;
wenzelm@11550
    44
esac
wenzelm@11550
    45
wenzelm@11550
    46
[ ! -x "$INTERFACE" ] && fail "Bad Isabelle interface: \"$ISABELLE_INTERFACE\""
wenzelm@11550
    47
wenzelm@11550
    48
exec "$INTERFACE" "$@"