aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev@truth.(none)>2010-01-21 14:24:39 +0300
committerIgor Pashev <pashev@truth.(none)>2010-01-21 14:24:39 +0300
commit4f0202339437bea4d6cfde3a2872bef9c9a4d2ff (patch)
tree34ece972484b26661c450f7e3d779b62c83e9941
parent09b828083bc9e5eafe351e1c6c562fafa06367ed (diff)
downloadbrainfuck-4f0202339437bea4d6cfde3a2872bef9c9a4d2ff.tar.gz
Brainfuck to C wrapper
-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
+