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