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
     1 #!/usr/bin/env bash
     2 #
     3 # $Id$
     4 # Author: Markus Wenzel, TU Muenchen
     5 #
     6 # Isabelle interface startup script.
     7 
     8 if [ -L "$0" ]; then
     9   TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')"
    10   exec "$(cd "$(dirname "$0")"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@"
    11 fi
    12 
    13 
    14 ## settings
    15 
    16 PRG="$(basename "$0")"
    17 
    18 ISABELLE_HOME="$(dirname "$0")/.."
    19 . "$ISABELLE_HOME/lib/scripts/getsettings" || \
    20   { echo "$PRG probably not called from its original place!"; exit 2; }
    21 
    22 
    23 ## diagnostics
    24 
    25 function fail()
    26 {
    27   echo "$1" >&2
    28   exit 2
    29 }
    30 
    31 
    32 ## main
    33 
    34 case "$ISABELLE_INTERFACE" in
    35   none)
    36     INTERFACE="$ISABELLE"
    37     ;;
    38   */*)
    39     INTERFACE="$ISABELLE_INTERFACE"
    40     ;;
    41   *)
    42     INTERFACE="$ISABELLE_HOME/lib/scripts/isa-$ISABELLE_INTERFACE"
    43     ;;
    44 esac
    45 
    46 [ ! -x "$INTERFACE" ] && fail "Bad Isabelle interface: \"$ISABELLE_INTERFACE\""
    47 
    48 exec "$INTERFACE" "$@"