tuned error messages;
authorwenzelm
Mon Nov 15 15:41:58 2010 +0100 (2010-11-15)
changeset 4054434e56a6668ba
parent 40543 38804edb8cf5
child 40545 956c2cc7fced
tuned error messages;
lib/scripts/run-polyml
lib/scripts/run-smlnj
     1.1 --- a/lib/scripts/run-polyml	Mon Nov 15 14:59:53 2010 +0100
     1.2 +++ b/lib/scripts/run-polyml	Mon Nov 15 15:41:58 2010 +0100
     1.3 @@ -9,24 +9,27 @@
     1.4  
     1.5  ## diagnostics
     1.6  
     1.7 +function fail()
     1.8 +{
     1.9 +  echo "$1" >&2
    1.10 +  exit 2
    1.11 +}
    1.12 +
    1.13  function fail_out()
    1.14  {
    1.15 -  echo "Unable to create output heap file: \"$OUTFILE\"" >&2
    1.16 -  exit 2
    1.17 +  fail "Unable to create output heap file: \"$OUTFILE\""
    1.18  }
    1.19  
    1.20  function check_file()
    1.21  {
    1.22 -  if [ ! -f "$1" ]; then
    1.23 -    echo "Unable to locate $1" >&2
    1.24 -    echo "Please check your ML system settings!" >&2
    1.25 -    exit 2
    1.26 -  fi
    1.27 +  [ ! -f "$1" ] && fail "Unable to locate \"$1\""
    1.28  }
    1.29  
    1.30  
    1.31  ## compiler executables and libraries
    1.32  
    1.33 +[ -z "$ML_HOME" ] && fail "Missing ML installation (ML_HOME)"
    1.34 +
    1.35  POLY="$ML_HOME/poly"
    1.36  check_file "$POLY"
    1.37  
     2.1 --- a/lib/scripts/run-smlnj	Mon Nov 15 14:59:53 2010 +0100
     2.2 +++ b/lib/scripts/run-smlnj	Mon Nov 15 15:41:58 2010 +0100
     2.3 @@ -9,19 +9,20 @@
     2.4  
     2.5  ## diagnostics
     2.6  
     2.7 +function fail()
     2.8 +{
     2.9 +  echo "$1" >&2
    2.10 +  exit 2
    2.11 +}
    2.12 +
    2.13  function fail_out()
    2.14  {
    2.15 -  echo "Unable to create output heap file: \"$OUTFILE\"" >&2
    2.16 -  exit 2
    2.17 +  fail "Unable to create output heap file: \"$OUTFILE\""
    2.18  }
    2.19  
    2.20  function check_mlhome_file()
    2.21  {
    2.22 -  if [ ! -f "$1" ]; then
    2.23 -    echo "Unable to locate $1" >&2
    2.24 -    echo "Please check your ML_HOME setting!" >&2
    2.25 -    exit 2
    2.26 -  fi
    2.27 +  [ ! -f "$1" ] && fail "Unable to locate \"$1\""
    2.28  }
    2.29  
    2.30  function check_heap_file()
    2.31 @@ -38,6 +39,8 @@
    2.32  
    2.33  ## compiler binaries
    2.34  
    2.35 +[ -z "$ML_HOME" ] && fail "Missing ML installation (ML_HOME)"
    2.36 +
    2.37  SML="$ML_HOME/sml"
    2.38  ARCH_N_OPSYS="$ML_HOME/.arch-n-opsys"
    2.39