From d8b2ed49c11f3f5441d615d3fe8f587740d562cf Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 27 Oct 2023 08:21:17 -0700 Subject: [PATCH 1/2] Make my fix to 2001/coupard more like original In linux clang does not support implicit int and it's an error. I ended up adding 'int' but to make it more like the original I added to the CSILENCE -Wno-implicit-int instead. Thus the code is the original and only the Makefile is different. The thanks file was updated for this but also other entries (nothing changed in the entries themselves, just changes in the description in the thanks file). --- 2001/coupard/Makefile | 38 +++------------------------- 2001/coupard/coupard.c | 2 +- thanks-for-fixes.md | 57 +++++++++++++++++++++++++++++++----------- 3 files changed, 48 insertions(+), 49 deletions(-) diff --git a/2001/coupard/Makefile b/2001/coupard/Makefile index fb4155958..1ae233869 100644 --- a/2001/coupard/Makefile +++ b/2001/coupard/Makefile @@ -38,7 +38,7 @@ include ../../var.mk # Common C compiler warnings to silence # -CSILENCE= -Wno-empty-body -Wno-pointer-sign -Wno-return-type -Wno-deprecated-non-prototype +CSILENCE= -Wno-empty-body -Wno-pointer-sign -Wno-return-type -Wno-deprecated-non-prototype -Wno-implicit-int # Common C compiler warning flags # @@ -124,8 +124,7 @@ ALT_TARGET= all: data ${TARGET} @${TRUE} -.PHONY: all alt data everything diff_orig_prog diff_prog_orig \ - diff_alt_prog diff_prog_alt diff_orig_alt diff_alt_orig \ +.PHONY: all alt data everything orig_prog_diff alt_prog_diff \ clean clobber install love haste waste maker easter_egg \ sandwich supernova deep_magic magic charon pluto @@ -147,47 +146,18 @@ data: ${DATA} everything: all alt @${TRUE} - -##################### -# make a difference # -##################### -# # diff orig source and source # -diff_orig_prog: ${PROG}.orig.c ${PROG}.c +orig_prog_diff: ${PROG}.orig.c ${PROG}.c @-${DIFF} -u ${PROG}.orig.c ${PROG}.c -# diff source and orig source -# -diff_prog_orig: ${PROG}.c ${PROG}.orig.c - @-${DIFF} -u ${PROG}.c ${PROG}.orig.c - # diff alt source and source # -diff_alt_prog: ${PROG}.c +alt_prog_diff: ${PROG}.c @-if [[ -e ${PROG}.alt.c ]]; then \ ${DIFF} -u ${PROG}.alt.c ${PROG}.c; \ fi -# diff source and alt source -# -diff_prog_alt: ${PROG}.c - @-if [[ -e ${PROG}.alt.c ]]; then \ - ${DIFF} -u ${PROG}.c ${PROG}.alt.c; \ - fi - -# diff orig and alt -# -diff_orig_alt: ${PROG}.orig.c - @-if [[ -e ${PROG}.alt.c ]]; then \ - ${DIFF} -u ${PROG}.orig.c ${PROG}.alt.c; \ - fi - -diff_alt_orig: - @-if [[ -e ${PROG}.alt.c ]]; then \ - ${DIFF} -u ${PROG}.alt.c ${PROG}.orig.c; \ - fi - ############### # utility rules diff --git a/2001/coupard/coupard.c b/2001/coupard/coupard.c index 558e41be4..b5cf042b3 100644 --- a/2001/coupard/coupard.c +++ b/2001/coupard/coupard.c @@ -28,7 +28,7 @@ $",p[6789]; int o[]={145,1145,1745,2545,3045,4045,4345,5145,5745,6369},i=0,j=0,l=0; -void e(int n,int h){ +void e(n,h){ for(j=0;n>0;n-=!(p[j++]^9)); for(;!n&&j[p]^9;j++)write(1,p+p[j][o],o[p[j]+1]-p[j][o]); for(i=0;i` for `mmap()` and `munmap()`. - have `main()` call another function which is no longer a recursive function; @@ -1530,9 +1553,15 @@ Finally to see from start to finish: git diff d2a42f42e8f477f29e9d5ed09ce2bb349eaf7397..4bc03de321612869aebf855850c6500df95cb6ef anonymous.c ``` +or to not use `git`: + +```sh +make diff_orig_prog +``` + Cody also added a [program](anonymous.bed.c) like [anonymous.ten.c](anonymous.ten.c) [Ten Green Bottles](https://en.wikipedia.org/wiki/Ten_Green_Bottles) but which -sings [Ten in the Bed](https://allnurseryrhymes.com/ten-in-the-bed/). +sings [Ten in the Bed](https://allnurseryrhymes.com/ten-in-the-bed/) instead. As well he added the [try.me.sh](2001/anonymous/try.me.sh) so that one can attempt to use the program as it was designed but if compiling as 32-bit fails @@ -1607,19 +1636,19 @@ void e(n,h){ ``` -One fix would be to disable that warning. Another one might be to change the C -standard. The one that was done, to make it more portable, was to just add 'int' -to the function parameters. +The easiest fix is to just disable the warning which is what was done. +Originally the code was changed to use `int` but to make it more like the +original this was undone. -Thanks go to Yusuke for providing a proper command line for macOS (to do with -sound; see his [/2013/endoh3/README.md](2013/endoh3/README.md) entry where he -also refers to sound devices in macOS). +Yusuke for providing a proper command line for macOS (to do with sound; see his +[/2013/endoh3/README.md](2013/endoh3/README.md) entry where he also refers to +sound devices in macOS). ## [2001/ctk](2001/ctk/ctk.c) ([README.md](2001/ctk/README.md])) The ANSI escape codes were no longer valid but Yusuke provided a patch to fix -the ANSI escape codes. This works with macOS as well. +the ANSI escape codes. Cody tested this for macOS and it works fine. ## [2001/dgbeards](2001/dgbeards/dgbeards.c) ([README.md](2001/dgbeards/README.md])) From 8e12c52456edbe01a6683239c6e36d5313c192eb Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 27 Oct 2023 08:30:53 -0700 Subject: [PATCH 2/2] Restore diff rules in 2001/coupard/Makefile I ended up not doing a git pull in the system with the problem (of implicit ints being an error) and so the Makefile used was the old one prior to the change in diff rules. This commit restores them and the silencing of implicit int warnings. --- 2001/coupard/Makefile | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/2001/coupard/Makefile b/2001/coupard/Makefile index 1ae233869..b643be7e2 100644 --- a/2001/coupard/Makefile +++ b/2001/coupard/Makefile @@ -124,7 +124,8 @@ ALT_TARGET= all: data ${TARGET} @${TRUE} -.PHONY: all alt data everything orig_prog_diff alt_prog_diff \ +.PHONY: all alt data everything diff_orig_prog diff_prog_orig \ + diff_alt_prog diff_prog_alt diff_orig_alt diff_alt_orig \ clean clobber install love haste waste maker easter_egg \ sandwich supernova deep_magic magic charon pluto @@ -146,18 +147,47 @@ data: ${DATA} everything: all alt @${TRUE} + +##################### +# make a difference # +##################### +# # diff orig source and source # -orig_prog_diff: ${PROG}.orig.c ${PROG}.c +diff_orig_prog: ${PROG}.orig.c ${PROG}.c @-${DIFF} -u ${PROG}.orig.c ${PROG}.c +# diff source and orig source +# +diff_prog_orig: ${PROG}.c ${PROG}.orig.c + @-${DIFF} -u ${PROG}.c ${PROG}.orig.c + # diff alt source and source # -alt_prog_diff: ${PROG}.c +diff_alt_prog: ${PROG}.c @-if [[ -e ${PROG}.alt.c ]]; then \ ${DIFF} -u ${PROG}.alt.c ${PROG}.c; \ fi +# diff source and alt source +# +diff_prog_alt: ${PROG}.c + @-if [[ -e ${PROG}.alt.c ]]; then \ + ${DIFF} -u ${PROG}.c ${PROG}.alt.c; \ + fi + +# diff orig and alt +# +diff_orig_alt: ${PROG}.orig.c + @-if [[ -e ${PROG}.alt.c ]]; then \ + ${DIFF} -u ${PROG}.orig.c ${PROG}.alt.c; \ + fi + +diff_alt_orig: + @-if [[ -e ${PROG}.alt.c ]]; then \ + ${DIFF} -u ${PROG}.alt.c ${PROG}.orig.c; \ + fi + ############### # utility rules