bin/isatool
author wenzelm
Tue Apr 22 11:37:12 1997 +0200 (1997-04-22)
changeset 3007 e5efa177ee0c
parent 2936 bd33e7aae062
child 3276 f8bf5e5c1641
permissions -rwxr-xr-x
removed -norc;
     1 #!/bin/bash
     2 #
     3 # $Id$
     4 #
     5 # Isabelle tool starter -- provides settings environment,
     6 #   and keeps your PATH name space clean.
     7 
     8 
     9 ## settings
    10 
    11 PRG=$(basename $0)
    12 
    13 ISABELLE_HOME=$(dirname $0)/..
    14 . $ISABELLE_HOME/lib/scripts/getsettings || \
    15   { echo "$PRG probably not called from its original place!"; exit 2; }
    16 
    17 
    18 ## diagnostics
    19 
    20 TOOLDIRS=$(echo $ISABELLE_TOOLS | tr : " ")
    21 
    22 function usage()
    23 {
    24   echo
    25   echo "Usage: $PRG TOOL [ARGS ...]"
    26   echo
    27   echo "  Start Isabelle utility program TOOL with ARGS. Pass \"-?\" to TOOL"
    28   echo "  for more specific help."
    29   echo
    30   echo "  Availabe tools are:"
    31   (
    32     for DIR in $TOOLDIRS
    33     do
    34       cd $DIR
    35       echo
    36       for T in *
    37       do
    38         if [ -f "$T" -a -x "$T" ]; then
    39           DESCRLINE=$(grep DESCRIPTION: "$T" | sed -e 's/^.*DESCRIPTION: *//')
    40           echo "    $T - $DESCRLINE"
    41         fi
    42       done
    43     done
    44   )
    45   echo
    46   exit 1
    47 }
    48 
    49 function fail()
    50 {
    51   echo "$1" >&2
    52   exit 2
    53 }
    54 
    55 
    56 ## args
    57 
    58 [ $# -lt 1 -o "$1" = "-?" ] && usage
    59 
    60 TOOLNAME="$1"
    61 shift
    62 
    63 
    64 ## main
    65 
    66 for DIR in $TOOLDIRS
    67 do
    68   TOOL=$DIR/$TOOLNAME
    69   [ -f "$TOOL" -a -x "$TOOL" ] && exec "$TOOL" "$@"
    70 done
    71 
    72 fail "Unknown isabelle tool: $TOOLNAME"