#!/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/null cp ioccc5o1.c bfunzip.b # Generate a Perl program that finds a hidden BrainF*** # program in ioccc5o1.c that reverses files echo 'Generating the file-reverse precursor program...' rm revfilup.pl 2>/dev/null cp ioccc5o1.c revfilup.pl # Generate a sed script to make it possible to pass # programs as arguments to the BrainF*** interpreter echo 'Creating the argument-passing sed script...' rm ioccc5.sed 2>/dev/null cat > ioccc5.sed </dev/null cat > newline.txt </dev/null cat > 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/null cat $1 newline.txt | sed -f ioccc5.sed > temp.sh sh temp.sh # inherits input/output redirection rm temp.sh EOF # 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/null cat ioccc5o1.c newline.txt | perl -p revfilup.pl > revfile.b # Generate the tab-remove program echo 'Generating the tab-removal program...' rm remtab.b 2>/dev/null sh runbf.sh bfunzip.b < ioccc5o1.c > remtab.b # Generate the triangular-cut program echo 'Generating the triangular-cut program...' rm tricut.pl 2>/dev/null sh runbf.sh revfile.b < ioccc5o1.c > tricut.pl # Generate the compressor program echo 'Generating the compressor program...' rm bfzip.b 2>/dev/null cat 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/null uuencode ioccc5o1.c '[[' > cat.b # Generate the letter-doubling program echo 'Generating the letter-doubling program...' rm doubcat.b 2>/dev/null sh runbf.sh bfzip.b < ioccc5o1.c > doubcat.b