/arc.sh
Shell | 47 lines | 33 code | 7 blank | 7 comment | 9 complexity | 9869e7ec32c843272cebd7271e976033 MD5 | raw file
1#!/bin/sh 2 3arc_dir=$(dirname "$(readlink "$0")") 4 5if [ "$1" = "--no-rl" ]; then 6 shift 7elif [ "$(type rlwrap)" ]; then 8 rl="rlwrap -C arc" 9fi 10 11# I wish there were some cleaner way to do this 12case "$(mzscheme --version)" in 13 *v4.*) plt4=yes;; 14 *v5.*) plt4=yes;; # compatible with v4 for the use in this script 15 *) plt4=no;; 16esac 17 18if [ $# -gt 0 ] 19then repl='#f' 20else 21 # It seems like there ought to be a program for determining whether standard 22 # input is a tty, but I can't find one; so we use mzscheme instead. 23 if [ $plt4 = yes ] 24 then repl=$(mzscheme -e '(terminal-port? (current-input-port))') 25 else repl=$(mzscheme -mve '(display (terminal-port? (current-input-port)))') 26 fi 27fi 28 29opts="--no-init-file" 30 31if [ $plt4 = yes ]; then 32 if [ $repl = '#t' ] 33 then 34 # AFAICT, there is no equivalent of --mute-banner for mzscheme v4. 35 # Please do NOT add -r/--script here, this removes the ability to access 36 # the Scheme REPL. See http://arclanguage.org/item?id=10356. 37 opts="$opts --repl --load" 38 else opts="$opts --script" 39 fi 40else 41 if [ $repl = '#t' ] 42 then opts="$opts --mute-banner --load" 43 else opts="$opts --script" 44 fi 45fi 46 47$rl mzscheme $opts $arc_dir/as.scm $@