From 04a9346a078f506e725c1b5d10a5c837f7820daa Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 03:59:25 -0700 Subject: [PATCH 1/9] Reorder/reword thanks for 1990/dds It now reads a bit better and puts the more important fixes earlier in the description. --- thanks-for-fixes.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index df3b40858..99e279910 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -396,19 +396,21 @@ judge and user the executioner? :-) ## [1990/dds](1990/dds/dds.c) ([README.md](1990/dds/README.md])) -Yusuke and Cody in conjunction fixed this for modern systems. +Yusuke and Cody in conjunction fixed this for modern systems (both fixed a +different compiler error but more fixes were also made). Yusuke added the comma operator for a binary expression with `free(3)` which is -an error because `free()` returns void. Cody then made it slightly more like the +is a compiler error because `free()` returns void. Cody then made it slightly more like the original in this way by redefining `free` to have the comma operator itself. -Cody removed the erroneous prototype to `fopen()` which caused a compiler error -and he also made this use `fgets()` instead of `gets()` to make it safer and to -prevent an annoying and potentially alarming warning at compiling and/or linking -and/or runtime. +Cody fixed another compiler error by removing the erroneous prototype to +`fopen()`. Cody also changed a file to be a proper `FILE *` and fixed a typo in +[LANDER.BAS](1990/dds/LANDER.BAS). -Cody also changed a file to be a proper `FILE *` and fixed a typo -in [LANDER.BAS](1990/dds/LANDER.BAS). +Cody also made this use `fgets()` instead of `gets()` to make it safer and to +prevent an annoying and potentially alarming warning at compiling and/or linking +and/or runtime, the latter of which is unfortunately interspersed with the +output of the program. Later Cody improved the `gets()`/`fgets()` fix by redefining `gets()` to use `fgets()`. Notice that the original entry used `fgets()` in one case as it has @@ -416,7 +418,6 @@ to read from another file and in this place nothing was changed. With these improvements the entry looks much more like the original! - ## [1990/jaw](1990/jaw/jaw.c) ([README.md](1990/jaw/README.md])) Cody fixed the script to work properly in modern environments (to do with `$PATH` From 8d05c31ba3c2d95d59c0ee4fac60086206e07133 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 04:14:19 -0700 Subject: [PATCH 2/9] Clarify case-sensitivity in 1990/dds There was a note that I added that it is case sensitive but it did not state that it's all caps which is required (the author noted this but that's further down in the file). This might be one of the only times caps lock is useful (though still not useful enough to enable :-) ) --- 1990/dds/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/1990/dds/README.md b/1990/dds/README.md index 82e1d75e5..2faae45bf 100644 --- a/1990/dds/README.md +++ b/1990/dds/README.md @@ -27,7 +27,9 @@ OLD LANDER.BAS RUN ``` -NOTE: this is case sensitive. +NOTE: this entry is probably one of the only times CAPS LOCK might be worth +having (though still not useful enough to enable :-) ) as all input has to be +UPPER CASE. ## Judges' remarks: From d90faeb9b12b21c76df9d62820ea667ade89935f Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 08:25:21 -0700 Subject: [PATCH 3/9] Update 2005/mikeash/.gitignore --- 2005/mikeash/.gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/2005/mikeash/.gitignore b/2005/mikeash/.gitignore index 0c1a6838d..b4be26601 100644 --- a/2005/mikeash/.gitignore +++ b/2005/mikeash/.gitignore @@ -1,3 +1,5 @@ mikeash mikeash.orig +mikeash2 +mikeash2.c prog.orig From 1e87c10dac15927ffa6a28165ce418be441ad380 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 08:27:12 -0700 Subject: [PATCH 4/9] Minor fixes in the thanks-for-fixes.md file --- thanks-for-fixes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 99e279910..09cf3e78b 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1389,7 +1389,7 @@ for strlen() with malloc(). This prevented it from working. ## [2006/borsanyi](2006/borsanyi/borsanyi.c) ([README.md](2006/borsanyi/README.md])) -Cody fixed (the Makefile) under some systems where the `lpthread` was not +Cody fixed the Makefile under some systems where the `lpthread` was not implicitly linked in. @@ -1406,7 +1406,7 @@ well segfault (for instance it segfaulted on his MacBook Pro with the M1 chip). ## [2006/night](2006/night/night.c) ([README.md](2006/night/README.md])) As Cody is a lost :-) `vim` user he took the author's remarks to add support -back for arrow keys. +back for arrow keys in the [alternate version](2006/night/night.alt.c). ## [2006/sloane](2006/sloane/sloane.c) ([README.md](2006/sloane/README.md])) From 1a907f13608f1f1ff93c65f84e29063991e2c5d3 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 08:28:20 -0700 Subject: [PATCH 5/9] Minor clarifications in 1986/marshall/README.md ...about the strange problems that prevented this entry from working, depending on whether the optimiser was enabled or not (different problems) that I fixed. This was documented at the idea of Landon as it is rather interesting and amusing. --- 1986/marshall/README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/1986/marshall/README.md b/1986/marshall/README.md index 0fa196320..2cc2eb860 100644 --- a/1986/marshall/README.md +++ b/1986/marshall/README.md @@ -9,11 +9,11 @@ make all ``` There is an alternate version. See the Alternate code section for the commentary -on why this is: there was a funny problem depending on the compiler and flags -where it would work with one compiler with the optimiser but it would not work -with the other; and if the optimiser state is changed the previous problematic -compiler might work but the other one would not! We describe this in more detail -below and we encourage you to read it. +on why this is: there was a funny problem in modern systems where depending on +the compiler and flags it would work with one compiler with the optimiser but it +would not work with the other; and if the optimiser state is changed the +previous problematic compiler might work but the other one would not! We +describe this in more detail below and we encourage you to read it. ## Try: @@ -30,10 +30,10 @@ you can see if your compiler has the problem as described below. In some versions of gcc and clang (this was first discovered in fedora linux 38) depending on whether or not the optimiser was enabled would cause one compiler -to segfault but not another but when changing the state of the optimiser the -opposite would happen: the compiler that did not segfault suddenly did and the -one that did now worked! Another problem was an infinite loop also depending on -the optimiser. +to generate code that segfaults but not another - but when changing the state +of the optimiser the opposite would happen: the compiler that did not cause a +segfault suddenly did and the one that did now worked! Another problem was an +infinite loop also depending on the optimiser. The alternate code has the original fix for clang which works with some compilers depending on the optimiser. When we refer to the code below we refer From b86f6dc73ece07ba616abb41b3d11446f847282a Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:23:31 -0700 Subject: [PATCH 6/9] Improve fix of 1990/tbr In particular the fix to make it more like the original. There was no need to have the function prototypes at the top of the file. I also added a couple -Wno- options to the CSILENCE variable in the Makefile. I also added to the Makefile so that make alt will build the alt version (only functional difference is that there is gets() instead of fgets()). --- 1990/tbr/Makefile | 7 ++++--- 1990/tbr/tbr.c | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/1990/tbr/Makefile b/1990/tbr/Makefile index b538fbe3b..8f74cbdaf 100644 --- a/1990/tbr/Makefile +++ b/1990/tbr/Makefile @@ -39,7 +39,8 @@ include ../../var.mk # Common C compiler warnings to silence # CSILENCE= -Wno-char-subscripts -Wno-error -Wno-implicit-function-declaration \ - -Wno-unused-value -Wno-deprecated-non-prototype -Wno-return-type + -Wno-unused-value -Wno-deprecated-non-prototype -Wno-return-type -Wno-implicit-int \ + -Wno-empty-body # Common C compiler warning flags # @@ -114,8 +115,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= -ALT_TARGET= +ALT_OBJ= ${PROG}.alt.o +ALT_TARGET= ${PROG}.alt ################# diff --git a/1990/tbr/tbr.c b/1990/tbr/tbr.c index 6292b0803..e867fb391 100644 --- a/1990/tbr/tbr.c +++ b/1990/tbr/tbr.c @@ -1,4 +1,3 @@ -int e(int x),r(int t,int o); #define gets(x)fgets((x),512,stdin) #define exit(x) exit((x)),0 #define D ,close( From 398c2b0ed07f905a00652136b56361405d4457ef Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:26:44 -0700 Subject: [PATCH 7/9] Add tbr.alt to 1990/tbr/.gitignore --- 1990/tbr/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/1990/tbr/.gitignore b/1990/tbr/.gitignore index 01f95f739..341d63c34 100644 --- a/1990/tbr/.gitignore +++ b/1990/tbr/.gitignore @@ -1,3 +1,4 @@ tbr tbr.orig +tbr.alt prog.orig From 5ae02fd2c9acbb0eb5d6b9b65885a82e22ffb2b3 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 11:27:13 -0700 Subject: [PATCH 8/9] Actually add 1990/tbr/tbr.alt.c to repo --- 1990/tbr/tbr.alt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 1990/tbr/tbr.alt.c diff --git a/1990/tbr/tbr.alt.c b/1990/tbr/tbr.alt.c new file mode 100644 index 000000000..61abc189d --- /dev/null +++ b/1990/tbr/tbr.alt.c @@ -0,0 +1,11 @@ +#define D ,close( +char*c,q[512],m[256],*v[99],**u,*i[3];int f[2],p;main(){for(m[m[60]=m[62]= +32]=m[*m=124[m]=9]=6;e(-8),gets(1+(c=q))||(exit(0),0);r(0,0))for(;*++c;);} +r(t,o){*i=i[2]=0;for(u=v+98;m[*--c]^9;m[*c]&32?i[*c&2]= +*u,u-v^98&&++u:3)if(!m[*c]){for(*++c=0;!m[*--c];);*--u= +++c;}u-v^98?strcmp(*u,"cd")?*c?pipe(f),o=f[1]:1,(p=fork())?e(p),o? +r(o,0)D o)D*f):4,wait(0):(o?dup2(*f,0)D*f)D o):*i?1 D +0),e(open(*i,0)):5,t?dup2(t,1)D t):i[2]?9 D +1),e(creat(i[2],438)):2,e(execvp(*u,u))):e(chdir(u[1])*2):6;} +e(x){x<0?write(2,"?\n$ "-x/4,2),x+1||(exit(1),0):5;} + From ae7e6ca529fc9887b7e29ee4b34a47a12a4a7f27 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Tue, 26 Sep 2023 12:24:12 -0700 Subject: [PATCH 9/9] Remove outdated message about macOS in 1985/applin I fixed this quite some time back but never removed the warning. Test compiling everything in the new macOS I discovered this and other problems which will have to be looked at later. --- 1985/applin/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/1985/applin/Makefile b/1985/applin/Makefile index c1e65d064..867a433c6 100644 --- a/1985/applin/Makefile +++ b/1985/applin/Makefile @@ -128,7 +128,6 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: this does not work properly in macOS." ${CC} ${CFLAGS} $< -o $@ ${LDFLAGS} # alternative executable