#!/bin/sh# Compile the C program into the BrainF*** interpreter.echo 'Compiling the C program into the BrainF*** interpreter...'gcc '-D_(a,b,_,d,e)=while(a(d(e(_?putchar(b):(c=getchar())<0?b:c))))' -Dunsigned= -funsigned-char -ansi -o ioccc5 -O2 ioccc5o1.c# Generate the decompressor program.echo 'Generating the decompressor program...'rm bfunzip.b 2>/dev/nullcp ioccc5o1.c bfunzip.b# Generate a Perl program that finds a hidden BrainF***# program in ioccc5o1.c that reverses filesecho 'Generating the file-reverse precursor program...'rm revfilup.pl 2>/dev/nullcp ioccc5o1.c revfilup.pl# Generate a sed script to make it possible to pass# programs as arguments to the BrainF*** interpreterecho 'Creating the argument-passing sed script...'rm ioccc5.sed 2>/dev/nullcat > ioccc5.sed <<EOF1 i\\#!/bin/sh\\ioccc5 '/'/ s/'//g$ a\\'EOF# Files are sometimes generated without required terminating# newlines, so create a file that's just a newlineecho 'Creating a newline-only file...'rm newline.txt 2>/dev/nullcat > newline.txt <<EOFEOF# Now generate runbf.sh, so we can run BrainF*** files easily.# Note that this cannot be piped with itself, as it creates# a temporary file.echo 'Creating a shell-script wrapper to the interpreter...'rm runbf.sh 2>/dev/nullcat > runbf.sh <<'EOF'#!/bin/sh# This program runs a BrainF*** program by filename. Assumes ioccc5.sed and newline.txt exist.rm temp.sh 2>/dev/nullcat $1 newline.txt | sed -f ioccc5.sed > temp.shsh temp.sh # inherits input/output redirectionrm temp.shEOF# Generate the file-reversing program (this program# is subject to buffer overflow, but is padded so that# the buffer is much larger than the original program so# that it can be safely used on it)echo 'Generating the file-reverse program...'rm revfile.b 2>/dev/nullcat ioccc5o1.c newline.txt | perl -p revfilup.pl > revfile.b# Generate the tab-remove programecho 'Generating the tab-removal program...'rm remtab.b 2>/dev/nullsh runbf.sh bfunzip.b < ioccc5o1.c > remtab.b# Generate the triangular-cut programecho 'Generating the triangular-cut program...'rm tricut.pl 2>/dev/nullsh runbf.sh revfile.b < ioccc5o1.c > tricut.pl# Generate the compressor programecho 'Generating the compressor program...'rm bfzip.b 2>/dev/nullcat ioccc5o1.c newline.txt | perl -p tricut.pl > bfzip.b# Generate the cat program (warning: this program has# a max file size. Keep input smaller than about 1k)echo 'Generating the buffer-overflowing cat program...'rm cat.b 2>/dev/nulluuencode ioccc5o1.c '[[' > cat.b# Generate the letter-doubling programecho 'Generating the letter-doubling program...'rm doubcat.b 2>/dev/nullsh runbf.sh bfzip.b < ioccc5o1.c > doubcat.b