#!/bin/sh

# {{{ here
# Make this PATH-independent
saveP="$PATH"
PATH="/usr/bin:/bin"

# imitate possibly-missing readlink
readlink() {
  ls -l -- "$1" | sed -e "s/^.* -> //"
}

# Remember current directory
saveD=`pwd`

# Find absolute path to this script,
# resolving symbolic references to the end
# (changes the current directory):
D=`dirname "$0"`
F=`basename "$0"`
cd "$D"
while test -h "$F"; do
  P=`readlink "$F"`
  D=`dirname "$P"`
  F=`basename "$P"`
  cd "$D"
done
D=`pwd`

# Restore current directory
cd "$saveD"

here="$D"
PATH="$saveP"
# }}} here

exec "$here/../../../bin/mzscheme" "$here/main.ss" "$@"
