aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbf2c20
1 files changed, 20 insertions, 0 deletions
diff --git a/bf2c b/bf2c
new file mode 100755
index 0000000..e43067c
--- /dev/null
+++ b/bf2c
@@ -0,0 +1,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
+