Fixes to 2001/herrmann1

The script herrmann1.sh invoked the program itself which is not needed
and would in fact invoke it during compilation as the script is what
compiles the program. The program is to be invoked via the script
itself but the script also compiles the program as well.

Fixed the script for shellcheck.

Note that there still is a problem in that with older gcc versions it's
supposed to animate on compilation but this no longer works. See the
bugs.md for details.
This commit is contained in:
Cody Boone Ferguson committed 2023-07-06 05:54:42 -07:00
1 parent e4c754ab0a
commit e0d4b98655
2 files changed
+40 -28

No files matched your search

+10 -12
View File
@@ -3,27 +3,25 @@
name=herrmann1
# Make sure things are clean to start with...
rm -f ${name} ${name}-1.c ${name}-2.c ${name}-3.c
rm -f "${name}" "${name}-1.c" "${name}-2.c" "${name}-3.c"
defs=""
for p in ${1+"$@"}; do
defs="$defs \"-D$p\""
done
cp ${name}.c ${name}-1.c
touch ${name}-3.c
cp "${name}.c" "${name}-1.c"
touch "${name}-3.c"
until cmp -s ${name}-1.c ${name}-3.c > /dev/null; do
eval ${CC:-cc} -E ${name}-1.c -o ${name}-2.c -P $defs 2> error || exit
mv -f ${name}-1.c ${name}-3.c
until cmp -s "${name}-1.c" "${name}-3.c" > /dev/null; do
eval "${CC:-cc}" -E "${name}-1.c" -o "${name}-2.c" -P "$defs" 2> error || exit
mv -f "${name}-1.c" "${name}-3.c"
sed -e 's/ */ /g' -e 's/^ //' -e '/^$/ d' -e 's:^/ \*:/*:' \
< ${name}-2.c > ${name}-1.c
head ${name}-1.c
< "${name}-2.c" > "${name}-1.c"
head "${name}-1.c"
done
eval ${CC:-cc} ${name}-1.c -o ${name} 2> error && rm error
eval ./${name}
eval "${CC:-cc}" "${name}-1.c" -o "${name}" 2> error && rm error
# Clean up intermediates...
rm -f ${name}-1.c ${name}-2.c ${name}-3.c
rm -f "${name}-1.c" "${name}-2.c" "${name}-3.c"