aboutsummaryrefslogtreecommitdiff
path: root/bf2c
blob: e43067cb491379416c15e8b3b0e3b3343d55db73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

set -e
set -u

BRAINFUCK=./brainfuck

if [ $# != 0 ]; then
    INDENT=$(which indent 2>/dev/null)
    BF="$1"
    C=${BF/.bf/.c}
    shift
    "$BRAINFUCK" -O -C "$@" "$BF" > "$C"
    if [ -x "$INDENT" ]; then
        "$INDENT" "$C"
    fi
fi

exit 0