Merge pull request #2207 from xexyl/primenum00-try
Bug fix 2000/primenum/try.sh
This commit is contained in:
6 files changed
+51
-85
No files matched your search
@@ -38,7 +38,8 @@ include ../../var.mk
|
||||
|
||||
# Common C compiler warnings to silence
|
||||
#
|
||||
CSILENCE=
|
||||
CSILENCE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \
|
||||
-Wno-int-conversion -Wno-pointer-to-int-cast -Wno-unused-parameter
|
||||
|
||||
# Common C compiler warning flags
|
||||
#
|
||||
@@ -57,8 +58,7 @@ ARCH=
|
||||
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
CDEFINE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \
|
||||
-Wno-int-conversion -Wno-pointer-to-int-cast -Wno-unused-parameter
|
||||
CDEFINE=
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
|
||||
@@ -6,16 +6,13 @@
|
||||
# make sure CC is set so that when we do make CC="$CC" it isn't empty. Doing it
|
||||
# this way allows us to have the user specify a different compiler in an easy
|
||||
# way.
|
||||
if [[ -z "$CC" ]]; then
|
||||
CC="cc"
|
||||
fi
|
||||
[[ -z "$CC" ]] && CC="cc"
|
||||
|
||||
make CC="$CC" all >/dev/null || exit 1
|
||||
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
|
||||
read -r -n 1 -p "Press any key to run: echo IOCCC 23209 | ./primenum 23209: "
|
||||
echo 1>&2
|
||||
echo IOCCC 23209 | ./primenum 23209
|
||||
@@ -27,9 +24,9 @@ echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32
|
||||
echo 1>&2
|
||||
|
||||
rm -f try.sh.txt
|
||||
read -r -n 1 -p "Press any key to run: ./primenum 101 < try.sh | ./primenum n > try.sh.txt: "
|
||||
read -r -n 1 -p "Press any key to run: ./primenum 101 < try.sh | ./primenum 101 > try.sh.txt: "
|
||||
echo 1>&2
|
||||
./primenum 101 < try.sh | ./primenum n > try.sh.txt
|
||||
./primenum 101 < try.sh | ./primenum 101 > try.sh.txt
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to show try.sh.txt (space = next page, q = quit): "
|
||||
@@ -37,8 +34,8 @@ echo 1>&2
|
||||
less -rEXFK try.sh.txt
|
||||
echo 1>&2
|
||||
|
||||
echo "$ diff try.sh try.sh.txt"
|
||||
read -r -n 1 -p "Press any key to see diff (space = next page, q = quit): " 1>&2
|
||||
diff try.sh try.sh.txt | less -rEXFK
|
||||
read -r -n 1 -p "Press any key to run: diff -s try.sh try.sh.txt: " 1>&2
|
||||
echo 1>&2
|
||||
diff -s try.sh try.sh.txt
|
||||
|
||||
rm -f try.sh.txt
|
||||
+20
-61
@@ -15,67 +15,26 @@ make CC="$CC" all >/dev/null || exit 1
|
||||
# clear screen after compilation so that only the entry is shown
|
||||
clear
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < adder.tofu: "
|
||||
echo 1>&2
|
||||
./birken < adder.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
birken()
|
||||
{
|
||||
if [[ "$#" -ne 1 ]]; then
|
||||
echo "$0: birken() requires exactly 1 arg, got: $#" 1>&2
|
||||
return
|
||||
fi
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < buffer.tofu: "
|
||||
echo 1>&2
|
||||
./birken < buffer.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
if [[ ! -f "$1" || ! -r "$1" ]]; then
|
||||
echo "$0: $1 not a regular readable file" 1>&2
|
||||
return
|
||||
fi
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < computer.tofu (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./birken < computer.tofu 2>/dev/null | less -rEXFK
|
||||
echo 1>&2
|
||||
read -r -n 1 -p "Press any key to run: ./birken < $1 (space = next page, q = quit): "
|
||||
echo 1>&2
|
||||
./birken < "$1" 2>/dev/null | less -rEXFK
|
||||
}
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < counter.tofu: "
|
||||
echo 1>&2
|
||||
./birken < counter.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < divider.tofu: "
|
||||
echo 1>&2
|
||||
./birken < divider.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < lfsr.tofu: "
|
||||
echo 1>&2
|
||||
./birken < lfsr.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < memory.tofu: "
|
||||
echo 1>&2
|
||||
./birken < memory.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < multiplier.tofu: "
|
||||
echo 1>&2
|
||||
./birken < multiplier.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < multiplier2.tofu: "
|
||||
echo 1>&2
|
||||
./birken < multiplier2.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < oneline.tofu: "
|
||||
echo 1>&2
|
||||
./birken < oneline.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < shift.tofu: "
|
||||
echo 1>&2
|
||||
./birken < shift.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < zuse.tofu: "
|
||||
echo 1>&2
|
||||
./birken < zuse.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
|
||||
read -r -n 1 -p "Press any key to run: ./birken < zuse2.tofu: "
|
||||
echo 1>&2
|
||||
./birken < zuse2.tofu 2>/dev/null
|
||||
echo 1>&2
|
||||
for f in adder.tofu buffer.tofu computer.tofu counter.tofu divider.tofu lfsr.tofu \
|
||||
memory.tofu multiplier.tofu multiplier2.tofu oneline.tofu shift.tofu zuse.tofu \
|
||||
zuse2.tofu; do
|
||||
|
||||
birken "$f"
|
||||
done
|
||||
@@ -206,7 +206,7 @@ clean:
|
||||
|
||||
clobber: clean
|
||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||
${RM} -rf *.dSYM
|
||||
${RM} -rf *.dSYM *.png *.xbm
|
||||
@-if [ -e sandwich ]; then \
|
||||
${RM} -f sandwich; \
|
||||
echo 'ate sandwich'; \
|
||||
|
||||
@@ -241,8 +241,8 @@ indent.c:
|
||||
# Suggest rules in this section
|
||||
#
|
||||
# This may not be much help to people who are not already familiar with
|
||||
# the tools needed to build the web site, but it is does print out a friendly
|
||||
# reminder to hose who to understand. For all else, there is "RTFS". :-)
|
||||
# the tools needed to build the web site, but it does print out a friendly
|
||||
# reminder to those who understand it. For all else, there is "RTFS". :-)
|
||||
#
|
||||
help:
|
||||
@echo make verify_entry_files
|
||||
@@ -284,35 +284,40 @@ genpath:
|
||||
fi
|
||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
||||
|
||||
# generate the top level authors.html page
|
||||
# generate the top level authors.html page using the
|
||||
# ${GEN_AUTHORS} tool (bin/gen-authors.sh).
|
||||
#
|
||||
gen_authors: ${GEN_AUTHORS} authors.html
|
||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||
${GEN_AUTHORS} -v 1
|
||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
||||
|
||||
# generate the top level location.html page
|
||||
# generate the top level location.html page using the
|
||||
# ${GEN_LOCATION} tool (bin/gen-location.sh).
|
||||
#
|
||||
gen_location: ${GEN_LOCATION} location.html
|
||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||
${GEN_LOCATION} -v 1
|
||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
||||
|
||||
# generate the top level years.html page
|
||||
# generate the top level years.html page using the ${GEN_YEARS}
|
||||
# tool (bin/gen-years.sh).
|
||||
#
|
||||
gen_years: ${GEN_YEARS} years.html
|
||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||
${GEN_YEARS} -v 1
|
||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
||||
|
||||
# force the build of all winner index.html files
|
||||
# force the build of ALL winner index.html files using
|
||||
# the ${README2INDEX} tool (bin/readme2index.sh)
|
||||
#
|
||||
entry_index: ${ALL_RUN} ${README2INDEX}
|
||||
entry_index readme2index: ${ALL_RUN} ${README2INDEX}
|
||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||
${ALL_RUN} -v 3 ${README2INDEX} -v 1
|
||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
||||
|
||||
# generate year level index.html files
|
||||
# generate year level index.html files using the
|
||||
# ${GEN_YEAR_INDEX} tool (bin/gen-year-index.sh).
|
||||
#
|
||||
gen_year_index: ${ALL_YEARS} ${GEN_YEAR_INDEX}
|
||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||
@@ -321,11 +326,12 @@ gen_year_index: ${ALL_YEARS} ${GEN_YEAR_INDEX}
|
||||
|
||||
# build winner index.html files that might be out of date
|
||||
#
|
||||
# This rule uses the QUICK_README2INDEX tool, so
|
||||
# some winner index.html files that seem to be up to date
|
||||
# This rule uses the ${QUICK_README2INDEX} tool
|
||||
# (bin/quick-readme2index.sh), so some winner
|
||||
# index.html files that seem to be up to date
|
||||
# (but might not be up to date) won't be built.
|
||||
#
|
||||
quick_entry_index: ${ALL_RUN} ${QUICK_README2INDEX}
|
||||
quick_entry_index quick_readme2index: ${ALL_RUN} ${QUICK_README2INDEX}
|
||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||
${ALL_RUN} -v 3 ${QUICK_README2INDEX} -v 1
|
||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
||||
|
||||
@@ -2557,6 +2557,10 @@ one-liner but rather a small program. At the same point Cody made the code
|
||||
itself a one-line like the code is in the original entry. Now it looks much more
|
||||
like the original entry but with the two fixes.
|
||||
|
||||
Finally Cody fixed the Makefile that had the `-Wno-foo` options in the `CDEFINE`
|
||||
variable which although works it is incongruent with the other Makefiles and is
|
||||
more confusing (even if not confusing).
|
||||
|
||||
|
||||
## <a name="2000_primenum"></a>[2000/primenum](/2000/primenum/primenum.c) ([README.md](/2000/primenum/README.md]))
|
||||
|
||||
|
||||
Reference in new issue
Block a user