Files
Cody Boone Ferguson d91bced2b8 Fix funny problem in 1989/fubar
In some cases if one were to modify the C code (possibly the same with
the script) in certain ways the program would fail to work even after
changing the code back. Trying to figure out what to put in bugs.md and
on a hunch, changing the fubar.sh script (in particular the ex(1) part)
remedies the problem (or so it seems from the various tests I have
performed including some that caused a problem). In particular:

    --- i/1989/fubar/fubar.sh
    +++ w/1989/fubar/fubar.sh
    @@ -7,13 +7,12 @@ if [[ $# -ne 1 ]]; then
	 exit 1
     fi

     # run/compile it
     rm -f ouroboros.c x1 x
    -ex - <<EOF
    -r fubar.c
    +ex fubar.c <<EOF
     8,9j
     w ouroboros.c
     EOF
     chmod +x ouroboros.c

The C code was also changed to make it even more like the original code.
2024-01-14 05:28:07 -08:00

19 lines
285 B
Bash
Executable File

#!/usr/bin/env bash
# to run fubar in the 'proper' way
# parse args
if [[ $# -ne 1 ]]; then
echo "usage: $0 number" 1>&2
exit 1
fi
# run/compile it
rm -f ouroboros.c x1 x
ex fubar.c <<EOF
8,9j
w ouroboros.c
EOF
chmod +x ouroboros.c
./ouroboros.c "$1"
#rm -f ouroboros.c x1 x