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
|
# 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
|
# Common C compiler warning flags
|
||||||
#
|
#
|
||||||
@@ -57,8 +58,7 @@ ARCH=
|
|||||||
|
|
||||||
# Defines that are needed to compile
|
# Defines that are needed to compile
|
||||||
#
|
#
|
||||||
CDEFINE= -Wno-error -Wno-implicit-function-declaration -Wno-implicit-int \
|
CDEFINE=
|
||||||
-Wno-int-conversion -Wno-pointer-to-int-cast -Wno-unused-parameter
|
|
||||||
|
|
||||||
# Include files that are needed to compile
|
# 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
|
# 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
|
# this way allows us to have the user specify a different compiler in an easy
|
||||||
# way.
|
# way.
|
||||||
if [[ -z "$CC" ]]; then
|
[[ -z "$CC" ]] && CC="cc"
|
||||||
CC="cc"
|
|
||||||
fi
|
|
||||||
|
|
||||||
make CC="$CC" all >/dev/null || exit 1
|
make CC="$CC" all >/dev/null || exit 1
|
||||||
|
|
||||||
# clear screen after compilation so that only the entry is shown
|
# clear screen after compilation so that only the entry is shown
|
||||||
clear
|
clear
|
||||||
|
|
||||||
|
|
||||||
read -r -n 1 -p "Press any key to run: echo IOCCC 23209 | ./primenum 23209: "
|
read -r -n 1 -p "Press any key to run: echo IOCCC 23209 | ./primenum 23209: "
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
echo IOCCC 23209 | ./primenum 23209
|
echo IOCCC 23209 | ./primenum 23209
|
||||||
@@ -27,9 +24,9 @@ echo THIS MESSAGE IS IN ALL CAPS | ./primenum 32
|
|||||||
echo 1>&2
|
echo 1>&2
|
||||||
|
|
||||||
rm -f try.sh.txt
|
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
|
echo 1>&2
|
||||||
./primenum 101 < try.sh | ./primenum n > try.sh.txt
|
./primenum 101 < try.sh | ./primenum 101 > try.sh.txt
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
|
|
||||||
read -r -n 1 -p "Press any key to show try.sh.txt (space = next page, q = quit): "
|
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
|
less -rEXFK try.sh.txt
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
|
|
||||||
echo "$ diff try.sh try.sh.txt"
|
read -r -n 1 -p "Press any key to run: diff -s try.sh try.sh.txt: " 1>&2
|
||||||
read -r -n 1 -p "Press any key to see diff (space = next page, q = quit): " 1>&2
|
echo 1>&2
|
||||||
diff try.sh try.sh.txt | less -rEXFK
|
diff -s try.sh try.sh.txt
|
||||||
|
|
||||||
rm -f 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 screen after compilation so that only the entry is shown
|
||||||
clear
|
clear
|
||||||
|
|
||||||
read -r -n 1 -p "Press any key to run: ./birken < adder.tofu: "
|
birken()
|
||||||
echo 1>&2
|
{
|
||||||
./birken < adder.tofu 2>/dev/null
|
if [[ "$#" -ne 1 ]]; then
|
||||||
echo 1>&2
|
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: "
|
if [[ ! -f "$1" || ! -r "$1" ]]; then
|
||||||
echo 1>&2
|
echo "$0: $1 not a regular readable file" 1>&2
|
||||||
./birken < buffer.tofu 2>/dev/null
|
return
|
||||||
echo 1>&2
|
fi
|
||||||
|
|
||||||
read -r -n 1 -p "Press any key to run: ./birken < computer.tofu (space = next page, q = quit): "
|
read -r -n 1 -p "Press any key to run: ./birken < $1 (space = next page, q = quit): "
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
./birken < computer.tofu 2>/dev/null | less -rEXFK
|
./birken < "$1" 2>/dev/null | less -rEXFK
|
||||||
echo 1>&2
|
}
|
||||||
|
|
||||||
read -r -n 1 -p "Press any key to run: ./birken < counter.tofu: "
|
for f in adder.tofu buffer.tofu computer.tofu counter.tofu divider.tofu lfsr.tofu \
|
||||||
echo 1>&2
|
memory.tofu multiplier.tofu multiplier2.tofu oneline.tofu shift.tofu zuse.tofu \
|
||||||
./birken < counter.tofu 2>/dev/null
|
zuse2.tofu; do
|
||||||
echo 1>&2
|
|
||||||
|
birken "$f"
|
||||||
read -r -n 1 -p "Press any key to run: ./birken < divider.tofu: "
|
done
|
||||||
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
|
|
||||||
@@ -206,7 +206,7 @@ clean:
|
|||||||
|
|
||||||
clobber: clean
|
clobber: clean
|
||||||
${RM} -f ${TARGET} ${ALT_TARGET}
|
${RM} -f ${TARGET} ${ALT_TARGET}
|
||||||
${RM} -rf *.dSYM
|
${RM} -rf *.dSYM *.png *.xbm
|
||||||
@-if [ -e sandwich ]; then \
|
@-if [ -e sandwich ]; then \
|
||||||
${RM} -f sandwich; \
|
${RM} -f sandwich; \
|
||||||
echo 'ate sandwich'; \
|
echo 'ate sandwich'; \
|
||||||
|
|||||||
@@ -241,8 +241,8 @@ indent.c:
|
|||||||
# Suggest rules in this section
|
# Suggest rules in this section
|
||||||
#
|
#
|
||||||
# This may not be much help to people who are not already familiar with
|
# 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
|
# the tools needed to build the web site, but it does print out a friendly
|
||||||
# reminder to hose who to understand. For all else, there is "RTFS". :-)
|
# reminder to those who understand it. For all else, there is "RTFS". :-)
|
||||||
#
|
#
|
||||||
help:
|
help:
|
||||||
@echo make verify_entry_files
|
@echo make verify_entry_files
|
||||||
@@ -284,35 +284,40 @@ genpath:
|
|||||||
fi
|
fi
|
||||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
@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
|
gen_authors: ${GEN_AUTHORS} authors.html
|
||||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||||
${GEN_AUTHORS} -v 1
|
${GEN_AUTHORS} -v 1
|
||||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
@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
|
gen_location: ${GEN_LOCATION} location.html
|
||||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||||
${GEN_LOCATION} -v 1
|
${GEN_LOCATION} -v 1
|
||||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
@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
|
gen_years: ${GEN_YEARS} years.html
|
||||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||||
${GEN_YEARS} -v 1
|
${GEN_YEARS} -v 1
|
||||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
@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 $@ =-=-=-=-='
|
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||||
${ALL_RUN} -v 3 ${README2INDEX} -v 1
|
${ALL_RUN} -v 3 ${README2INDEX} -v 1
|
||||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
@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}
|
gen_year_index: ${ALL_YEARS} ${GEN_YEAR_INDEX}
|
||||||
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
@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
|
# build winner index.html files that might be out of date
|
||||||
#
|
#
|
||||||
# This rule uses the QUICK_README2INDEX tool, so
|
# This rule uses the ${QUICK_README2INDEX} tool
|
||||||
# some winner index.html files that seem to be up to date
|
# (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.
|
# (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 $@ =-=-=-=-='
|
@echo '=-=-=-=-= IOCCC begin make $@ =-=-=-=-='
|
||||||
${ALL_RUN} -v 3 ${QUICK_README2INDEX} -v 1
|
${ALL_RUN} -v 3 ${QUICK_README2INDEX} -v 1
|
||||||
@echo '=-=-=-=-= IOCCC complete make $@ =-=-=-=-='
|
@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
|
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.
|
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]))
|
## <a name="2000_primenum"></a>[2000/primenum](/2000/primenum/primenum.c) ([README.md](/2000/primenum/README.md]))
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user