From eed35127ccbfdcca85f40f98fac5983cd61008ab Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 08:36:28 -0800 Subject: [PATCH 01/12] Minor update to 1994/weisberg To make the entry a bit more user friendly and also easier to use with other tools (in a pipeline - if anyone wanted to for some reason) the Makefile was modified to print a newline after each number rather than a space. I noticed that the Alternate code section had no subsections for 'Alternate build' or 'Alternate use' and these were added as well. I am not sure how this happened but I might do a quick pass through over all entries once everything else is done just to be sure. --- 1994/weisberg/Makefile | 2 +- 1994/weisberg/README.md | 25 ++++++++++++++++++++++--- thanks-for-fixes.md | 7 +++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/1994/weisberg/Makefile b/1994/weisberg/Makefile index 4d6e78a6d..bcf35133b 100644 --- a/1994/weisberg/Makefile +++ b/1994/weisberg/Makefile @@ -60,7 +60,7 @@ ARCH= # CDEFINE= -Dc='n*n>x?p:((m=*(b+1)),N))' \ -DN='((b=t+1),x+=2,x>e?exit(0):o' \ - -Dp='(a-t Date: Sat, 25 Nov 2023 09:31:08 -0800 Subject: [PATCH 02/12] Add second arg to main in 1995/cdua .. in both versions. --- 1995/cdua/cdua.alt.c | 10 +++++----- 1995/cdua/cdua.c | 10 +++++----- thanks-for-fixes.md | 7 +++++++ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/1995/cdua/cdua.alt.c b/1995/cdua/cdua.alt.c index bdbae0891..1e5f3066c 100644 --- a/1995/cdua/cdua.alt.c +++ b/1995/cdua/cdua.alt.c @@ -8,13 +8,13 @@ char*u0=" to begin... ",*u1="Already been here!",*u2="Found a wall! \ ",*u3="Walking... ",*u4="Finished. ",*u5="Going back..\ . ",*o="\033[23;1HDone!!\n",*x="\033[2J",*y="\033[1;1H",*z="\033[%d;%\ dH%c",*w="\033[1;1H%s",*v="\033[%d;%dH%c\033[%d;%dH%c\033[%d;%dH%c",b[1841 -];int c,d,e,f,g;typedef int(*h)();h i,k,l,m,n;rand( -),time(),getchar();int main(int a){k=rand,l=time,m=getchar, +];int c,d,e,f,g;typedef int(*h)();h i,k,l,m;int(*n)(int,char**);rand( +),time(),getchar();int main(int a,char**j){k=rand,l=time,m=getchar, n=main;if(!c)for(srand(l(0)),g=a=1000,--d;++d<1840;b[c=d]=" #\n"[d%80==79?2:d/80 &&d%80&&d/80-22&&d%80-78]);if(!(c-1839))++c,printf("%s%s%s",x,y,b);k:if(!(c-1840) &&(b[a+2]+b[a-2]+b[a+160]+b[a-160]-4*' ')){while(b[a+(f=(e=k()%4)?e-1?e-2?-1 :1:-80:80)*2]!='#');b[a]=b[a+f]=b[f+a+f]=' ';printf(v,a/80+1,1+a%80,' ',(a+f)/80+ -1,1+(a+f)%80,' ',(f+a+f)/80+1,1+(f+a+f)%80,' ');n(f+a+f);goto k;}else if(!(g +1,1+(a+f)%80,' ',(f+a+f)/80+1,1+(f+a+f)%80,' ');n(f+a+f,0);goto k;}else if(!(g -a))c=1,a=162,printf(w,u0),m();if(c-1){}else r b[a]!=' '?(usleep(Z),printf(w,b[a]=='.'?u1:u2),0) -:(b[a]='.',printf(w,u3),printf(z,a/80+1,1+a%80,'.'),a==1676?(printf(w,u4),printf(o),1):n(a+1)||n -(a+80)||n(a-80)||n(a-1)?1:(b[a]=' ',printf(w,u5),printf(z,a/80+1,1+a%80,' '),0));r 0;} +:(b[a]='.',printf(w,u3),printf(z,a/80+1,1+a%80,'.'),a==1676?(printf(w,u4),printf(o),1):n(a+1,0)||n +(a+80,0)||n(a-80,0)||n(a-1,0)?1:(b[a]=' ',printf(w,u5),printf(z,a/80+1,1+a%80,' '),0));r 0;} diff --git a/1995/cdua/cdua.c b/1995/cdua/cdua.c index 38dcaa85a..2e7fe999c 100644 --- a/1995/cdua/cdua.c +++ b/1995/cdua/cdua.c @@ -4,13 +4,13 @@ char*u0=" to begin... ",*u1="Already been here!",*u2="Found a wall! \ ",*u3="Walking... ",*u4="Finished. ",*u5="Going back..\ . ",*o="\033[23;1HDone!!\n",*x="\033[2J",*y="\033[1;1H",*z="\033[%d;%\ dH%c",*w="\033[1;1H%s",*v="\033[%d;%dH%c\033[%d;%dH%c\033[%d;%dH%c",b[1841 -];int c,d,e,f,g;typedef int(*h)();h i,k,l,m,n;rand( -),time(),getchar();int main(int a){k=rand,l=time,m=getchar, +];int c,d,e,f,g;typedef int(*h)();h i,k,l,m;int(*n)(int,char**);rand( +),time(),getchar();int main(int a,char**j){k=rand,l=time,m=getchar, n=main;if(!c)for(srand(l(0)),g=a=1000,--d;++d<1840;b[c=d]=" #\n"[d%80==79?2:d/80 &&d%80&&d/80-22&&d%80-78]);if(!(c-1839))++c,printf("%s%s%s",x,y,b);k:if(!(c-1840) &&(b[a+2]+b[a-2]+b[a+160]+b[a-160]-4*' ')){while(b[a+(f=(e=k()%4)?e-1?e-2?-1 :1:-80:80)*2]!='#');b[a]=b[a+f]=b[f+a+f]=' ';printf(v,a/80+1,1+a%80,' ',(a+f)/80+ -1,1+(a+f)%80,' ',(f+a+f)/80+1,1+(f+a+f)%80,' ');n(f+a+f);goto k;}else if(!(g +1,1+(a+f)%80,' ',(f+a+f)/80+1,1+(f+a+f)%80,' ');n(f+a+f,0);goto k;}else if(!(g -a))c=1,a=162,printf(w,u0),m();if(c-1){}else r b[a]!=' '?(printf(w,b[a]=='.'?u1:u2),0) -:(b[a]='.',printf(w,u3),printf(z,a/80+1,1+a%80,'.'),a==1676?(printf(w,u4),printf(o),1):n(a+1)||n -(a+80)||n(a-80)||n(a-1)?1:(b[a]=' ',printf(w,u5),printf(z,a/80+1,1+a%80,' '),0));r 0;} +:(b[a]='.',printf(w,u3),printf(z,a/80+1,1+a%80,'.'),a==1676?(printf(w,u4),printf(o),1):n(a+1,0)||n +(a+80,0)||n(a-80,0)||n(a-1,0)?1:(b[a]=' ',printf(w,u5),printf(z,a/80+1,1+a%80,' '),0));r 0;} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index c53460c76..92f825eb7 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1808,6 +1808,13 @@ particular to make it easier to see the program do what it does in systems that are too fast ... if there is such a thing anyway :-) ). See the README.md for details on this. +Out of an abundance of caution with clang, Cody also added a second arg to +`main()` as some versions of clang whine about the number of args on top of the +type of args. In particular some versions supposedly only allow 0, 2 or 3 args. +It actually appears to allow 1 but if you specify 4 it says 0, 2 or 3 and it is +an error but it's entirely possible that they will eventually make the defect +function as the error message claims. + ## [1995/dodsond1](1995/dodsond1/dodsond1.c) ([README.md](1995/dodsond1/README.md])) From 6eed1e80447424f5839483b3a7412373e5217c3c Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 09:48:37 -0800 Subject: [PATCH 03/12] Rename test scripts in 1995/garry to try This is to match the other entries (they also run more than one command now). --- 1995/garry/README.md | 8 ++------ 1995/garry/garry.alt.test.sh | 13 ------------- 1995/garry/garry.test.sh | 13 ------------- 1995/garry/try.alt.sh | 30 ++++++++++++++++++++++++++++++ 1995/garry/try.sh | 31 +++++++++++++++++++++++++++++++ thanks-for-fixes.md | 10 +++++----- 6 files changed, 68 insertions(+), 37 deletions(-) delete mode 100755 1995/garry/garry.alt.test.sh delete mode 100755 1995/garry/garry.test.sh create mode 100755 1995/garry/try.alt.sh create mode 100755 1995/garry/try.sh diff --git a/1995/garry/README.md b/1995/garry/README.md index bc142e2db..6631f39f7 100644 --- a/1995/garry/README.md +++ b/1995/garry/README.md @@ -15,9 +15,7 @@ make all ### Try: ```sh -./garry.test.sh - -./garry < README.md +./try.sh ``` @@ -46,9 +44,7 @@ make alt ### Alternate try: ```sh -GARRY=garry.alt ./garry.test.sh - -./garry.alt < README.md +./try.alt.sh ``` diff --git a/1995/garry/garry.alt.test.sh b/1995/garry/garry.alt.test.sh deleted file mode 100755 index c6f980c80..000000000 --- a/1995/garry/garry.alt.test.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env sh -# -# garry.alt.test.sh - example of how to use garry.alt - -EXAMPLEON="\33\133\61\73\67\155" -EXAMPLEOFF="\33\133\155" -DOLLAR="$" -export EXAMPLEON EXAMPLEOFF DOLLAR - -# make sure alt code is built, first -make alt || exit 1 - -./garry.alt /dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + +echo "$ EXAMPLEON=\"\33\133\61\73\67\155\"; EXAMPLEOFF=\"\33\133\155\"; DOLLAR=\"$\"" 1>&2 +EXAMPLEON="\33\133\61\73\67\155" +EXAMPLEOFF="\33\133\155" +DOLLAR="$" +export EXAMPLEON EXAMPLEOFF DOLLAR + +read -r -n 1 -p "Press any key to run: ./garry.alt < garry.data | less (q = quit, space = next page): " + +./garry.alt &2 + +read -r -n 1 -p "Press any key to run: ./garry.alt < README.md | less (q = quit, space = next page): " +./garry.alt < README.md | less -X diff --git a/1995/garry/try.sh b/1995/garry/try.sh new file mode 100755 index 000000000..18f6d2476 --- /dev/null +++ b/1995/garry/try.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh +# +# try.sh - demonstrate IOCCC winner 1995/garry +# + +# 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 + +make CC="$CC" all >/dev/null || exit 1 + +# clear screen after compilation so that only the entry is shown +clear + + +echo "$ EXAMPLEON=\"\33\133\61\73\67\155\"; EXAMPLEOFF=\"\33\133\155\"; DOLLAR=\"$\"" 1>&2 +EXAMPLEON="\33\133\61\73\67\155" +EXAMPLEOFF="\33\133\155" +DOLLAR="$" +export EXAMPLEON EXAMPLEOFF DOLLAR + +read -r -n 1 -p "Press any key to run: ./garry < garry.data | less (q = quit, space = next page): " + +./garry &2 + +read -r -n 1 -p "Press any key to run: ./garry < README.md | less (q = quit, space = next page): " +./garry < README.md | less -X diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 92f825eb7..9ede25260 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1834,15 +1834,15 @@ problem was a missing `int` for the `f` variable. He felt it was even more important that it works because the layout does indeed look to him like a rat is dropping core :-), something that the judges suggested. -Cody also improved the script [garry.test.sh](1995/garry/garry.test.sh) to make -sure the program is compiled before trying to use it and he also added the -[garry.alt.test.sh](1995/garry/garry.alt.test.sh) script to use the alt version, +Cody also renamed `garry.test.sh` to [try.sh](1995/garrytry.sh) and improved it +to to make sure the program is compiled before trying to use it and he also +added the [try.alt.sh](1995/garry/try.alt.sh) script to use the alt version, though the alt version is not as important as alt code in other entries. The reason the alt script was added rather than using an environmental variable to specify which one to use is to make it easier on the user as typing -`GARRY=garry.alt ./garry.test.sh` is not as simple (even though simple) as just -running `./garry.alt.test.sh`. +`GARRY=garry.alt ./try.sh` is not as simple (even though simple) as just +running `./try.alt.sh`. ## [1995/leo](1995/leo/leo.c) ([README.md](1995/leo/README.md])) From acbc9abb350fac9ccfe7ebe08a6d9157b168724e Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:09:54 -0800 Subject: [PATCH 04/12] Formatting fix in thanks file for 1995/makarios --- thanks-for-fixes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 9ede25260..641c29fc6 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1855,7 +1855,7 @@ by the author, putting it in [spoiler1.md](1995/leo/spoiler1.md). Cody fixed this so that it will compile with versions of clang that has a defect which only allows `main()` to have 0, 2 or 3 args. This is done by a new -function (`pain()` as it's annoying that clang is this way :-) ) that main() +function (`pain()` as it's annoying that clang is this way :-) ) that `main()` calls which has the four args. From 6db290e89e0e97e149ce4cc540f5238704bad241 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:18:23 -0800 Subject: [PATCH 05/12] Make my fix to 1996/westley more like original --- 1996/westley/westley.c | 2 +- thanks-for-fixes.md | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/1996/westley/westley.c b/1996/westley/westley.c index 46d2475b5..e64e28323 100644 --- a/1996/westley/westley.c +++ b/1996/westley/westley.c @@ -1 +1 @@ -main(h,m)int h;char**m;{if(h>4){for(time(*m);h/=2;);puts(m[4]);}} +main(h,m)char**m;{if(h>4){for(time(*m);h/=2;);puts(m[4]);}} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 641c29fc6..3335cc473 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1979,6 +1979,9 @@ clocks, both with the fixed version and the original (alt) version. Also, to fix any potential problem with displaying in GitHub the scripts provided by the author, Cody added '.sh'. +Later Cody made the entry look more like the original, removing the `argc` in +`main()` (K&R style functions). + # 1998 From 16bb6ae2f2edb8a9f21e1596e143a3d3aefb611d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:23:41 -0800 Subject: [PATCH 06/12] Add second arg to main() in 1998/bas1 --- 1998/bas1/bas1.c | 2 +- thanks-for-fixes.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/1998/bas1/bas1.c b/1998/bas1/bas1.c index 451e47681..6fbd9875b 100644 --- a/1998/bas1/bas1.c +++ b/1998/bas1/bas1.c @@ -23,7 +23,7 @@ char r[]="C#S3K+[;G'W7OB/_? ? [48][3]={ { { 2} } } ; void**V,*D,*F[32][48]; void*Q(void**O){ return*O?(*O=Q(*O)):O; } U( O){return E+=(O/=2)-1?U((A=A/2^57525273+(A& -1^O&1)*9583591<<5,O)),0:O,16; } main(O){ A +1^O&1)*9583591<<5,O)),0:O,16; } main(O,S)char**S;{ A =O?time(D):953351751; z I=0; I<26; ++I){z N=I/2; N<30+I/2; ++N){ z M=0; M<3; ++M){ p Z=O)z; (B=I+Z*!!M) <26&&N+Z*(M!=2)-B/ diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 3335cc473..39d0ae042 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1996,6 +1996,16 @@ they do have page up and page down but this gives a default for those who don't have them like with Macs. +## [1998/bas1](1998/bas1/bas1.c) ([README.md](1998/bas1/README.md])) + +Cody, out of an abundance of caution, added a second arg to `main()` as some +versions of clang whine about the number of args on top of what type they are +In particular some versions claim that they only allow 0, 2 or 3 args. It +appears that they do allow 1 but for instance 4 is not allowed. However as it's +quite possible they will 'fix' this defect it would be better to have this not +be a problem at such a time. + + ## [1998/bas2](1998/bas2/bas2.c) ([README.md](1998/bas2/README.md])) Cody added the [try.sh](1998/bas2/try.sh) script which runs some default actions From fd2849c8e5c35b4d52461463073c47fc6c779a59 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:25:32 -0800 Subject: [PATCH 07/12] Fix typo in thanks for 1998/df --- thanks-for-fixes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 39d0ae042..36adfe4d2 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2024,9 +2024,9 @@ Cody changed a `int *` used for `fopen(3)` to be a `FILE *` to be more correct and prevent any possible problems in some systems (which has happened). Cody also made the fixed version look more like the original version by using -the old style of `main()` args so that it read `i,love_unix` more naturally, and -by changing the typedef `lint` (to `int` - see the code for why this has to be -done in modern systems) to be `_int`. +the old style of `main()` args so that it reads `i,love_unix` more naturally, +and by changing the typedef `lint` (to `int` - see the code for why this has to +be done in modern systems) to be `_int`. ## [1998/dlowe](1998/dlowe/dlowe.c) ([README.md](1998/dlowe/README.md])) From 2c37f1fd7e36fef17d17d172730b4e46d76fa735 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:36:10 -0800 Subject: [PATCH 08/12] Add second arg to main() in 1998/fanf As it is mostly just the C pre-processor I added a macro that is part of main()'s args. --- 1998/fanf/fanf.c | 3 ++- thanks-for-fixes.md | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/1998/fanf/fanf.c b/1998/fanf/fanf.c index 1d0381f88..a00a48763 100644 --- a/1998/fanf/fanf.c +++ b/1998/fanf/fanf.c @@ -1,6 +1,7 @@ #define i int #define n struct n + #define T , char **C) { return ( #define x ){ return ( #define A -> #define N n* @@ -56,7 +57,7 @@ i j k c ? O U r u U U X : y b k y d k y #define b(b) ( ( b a d #define E(E) b ( M E u X ) -main k i ) ! ( +main ( i c T #define I b ( m I u X ) #define J b ( m J u X ) diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 36adfe4d2..84a27673e 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2062,6 +2062,13 @@ final code that is compiled. The code is now what it essentially becomes when processed completely. The intermediate steps can now be performed to see how it expands but it can still compile and be used. +Cody also added a second arg to `main()` out of an abundance of caution as some +versions of clang whine about the number of args to `main()`. These versions +claim that only 0, 2 or 3 are allowed but it does allow 1 anyway. It is quite +possible though that this will change so it is fixed in case this happens. As it +is mostly just through the C pre-processor Cody added a new macro to do +translate to the rest of `main()`'s args. + Cody also added the [try.sh](1998/fanf/try.sh) script to show the output of some of the expressions that we selected. From aec0f0ca64b5b73232375c15018208cf6800c9a0 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:39:16 -0800 Subject: [PATCH 09/12] Add int before register in 1998/schweikh2 That is in main(). It works now and it might be implicit but just in case clang ever has a problem with this it should now be satisfied. --- 1998/schweikh2/schweikh2.c | 2 +- thanks-for-fixes.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/1998/schweikh2/schweikh2.c b/1998/schweikh2/schweikh2.c index 3c61deb1a..502f8cf65 100644 --- a/1998/schweikh2/schweikh2.c +++ b/1998/schweikh2/schweikh2.c @@ -9,7 +9,7 @@ static volatile sig_atomic_t One; in??/ t #line 10 ONE(O(1,1,2,6,0,6)) -main (register zero, char **ONE) +main (register int zero, char **ONE) %: <% switch (sizeof __FILE__ < zero) case 1: return One /= zero; { auto one = zero = atoi (ONE<:zero-1:>); diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 84a27673e..c7155c10d 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2172,6 +2172,10 @@ interesting historical explanation and further details and fun, see the [historical remarks](1998/schweikh2/README.md#historical-remarks) in the README.md. +Cody also added an `int` after `register` in `main()` in case clang decides to +have a problem with that in the future which is not entirely out of the +question. + ## [1998/schweikh3](1998/schweikh3/schweikh3.c) ([README.md](1998/schweikh3/README.md])) From 10745091acb87f81e7a6a74ddaf7b5ca753a8936 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 10:53:32 -0800 Subject: [PATCH 10/12] Add second arg to main() in 1998/schweikh3 --- 1998/schweikh3/schweikh3.alt.c | 2 +- 1998/schweikh3/schweikh3.c | 2 +- thanks-for-fixes.md | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/1998/schweikh3/schweikh3.alt.c b/1998/schweikh3/schweikh3.alt.c index b6db1c87b..d1a7cf8b1 100644 --- a/1998/schweikh3/schweikh3.alt.c +++ b/1998/schweikh3/schweikh3.alt.c @@ -77,7 +77,7 @@ i-3; w =e+s+1; l=q+N* (j-1)- j*(j-1 )/ 2 ; do{ * 2; } } M5(q); } Z M2 P(t*p ){ H p){ P(p _ R); H p _ c>1){ M1 i=0 ; f*l= p _ l; for (; i< p _ c; ++i ){ A[i ]= l _ n; l=l _ x; } C (p _ s, p _ c); } P (p _ - L) ; } } int main V { t*r= 0; I F ; for (; ; ) + L) ; } } int main (M7,M6)I*M6; { t*r= 0; I F ; for (; ; ) { H!(F U 1024)) )X H ! fgets( F,1024 ,stdin) )break; *(F+(y =strlen(F))-1)= 0; H!( F=M3(F, y)))X H stat(F,&S)==0 &&S_ISREG(S. st_mode)&&S O )r=J(r ,F ); } H r)P(r ); u 0; }/* Obfuscated C diff --git a/1998/schweikh3/schweikh3.c b/1998/schweikh3/schweikh3.c index ef8aa1c09..5792eff3c 100644 --- a/1998/schweikh3/schweikh3.c +++ b/1998/schweikh3/schweikh3.c @@ -53,7 +53,7 @@ i-3; w =e+s+1; l=q+N* (j-1)- j*(j-1 )/ 2 ; do{ * 2; } } M5(q); } Z M2 P(t*p ){ H p){ P(p _ R); H p _ c>1){ M1 i=0 ; f*l= p _ l; for (; i< p _ c; ++i ){ A[i ]= l _ n; l=l _ x; } C (p _ s, p _ c); } P (p _ - L) ; } } int main V { t*r= 0; I F ; for (; ; ) + L) ; } } int main (M7,M6)I*M6; { t*r= 0; I F ; for (; ; ) { H!(F U 1024)) )X H ! fgets( F,1024 ,stdin) )break; *(F+(y =strlen(F))-1)= 0; H!( F=M3(F, y)))X H stat(F,&S)==0 &&S_ISREG(S. st_mode)&&S O )r=J(r ,F ); } H r)P(r ); u 0; }/* Obfuscated C diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index c7155c10d..65f5c8bff 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2183,6 +2183,11 @@ Cody added the [alternate code](1998/schweikh3/README.md#alternate-code) which a to reconfigure the size constant in the rare case that the author wrote about occurs. +Cody made `main()` have two args out of an abundance of caution as some versions +of clang say that `main()` can only have 0, 2 or 3 args. These versions accept 1 +arg but it is entirely possible that they fix this so this should prevent it +from breaking if that happens. + Cody added the [try.sh](1998/schweikh3/try.sh) script to make it easier to try the commands that we suggested. One command was not added, that of the to use command. From 9c9c0d3962a415aeedc36f3ae3da3a0b5dbbc61d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 11:02:13 -0800 Subject: [PATCH 11/12] Update things-todo.md - about 2001/westley --- tmp/things-todo.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tmp/things-todo.md b/tmp/things-todo.md index 70d4ece3c..30afe1328 100644 --- a/tmp/things-todo.md +++ b/tmp/things-todo.md @@ -1,5 +1,5 @@ # A todo list of known things to check and/or do -*Last updated: Wed 22 Nov 2023 13:02:04 UTC* +*Last updated: Sat 25 Nov 2023 19:01:07 UTC* This document is primarily for [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) as he (that is I :-) ) wanted a way @@ -157,3 +157,6 @@ make it consistent and easy to remember. going too fast we should say not what it looks like in modern systems but rather what it LOOKED LIKE AT THE TIME. At Wed 22 Nov 2023 13:02:04 UTC the only entry that has had this done is [1985/lycklama](1985/lycklama/README.md). + +- Check 2001/westley for making `main()` have two args. Easy to make it have two +args but harder to make it function right. From 4e736301ad03b5627dc4ff179f30314416e8817d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 25 Nov 2023 11:10:45 -0800 Subject: [PATCH 12/12] Add second arg to main in 2004/kopczynski --- 2004/kopczynski/kopczynski.c | 2 +- thanks-for-fixes.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/2004/kopczynski/kopczynski.c b/2004/kopczynski/kopczynski.c index d18e60a23..ea5e5e7ac 100644 --- a/2004/kopczynski/kopczynski.c +++ b/2004/kopczynski/kopczynski.c @@ -1 +1 @@ -main(O){int I,Q,l=O;if(I=l*4){l=6;if(l>5)l+=Q-8?l-(Q=getchar()-2)%2:l;if(Q*=2)O+="has dirtiest IF"[(I/-Q&12)-l/Q%4];}printf("%d\n",8+O%4);} +main(O,S)char**S;{int I,Q,l=O;if(I=l*4){l=6;if(l>5)l+=Q-8?l-(Q=getchar()-2)%2:l;if(Q*=2)O+="has dirtiest IF"[(I/-Q&12)-l/Q%4];}printf("%d\n",8+O%4);} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 65f5c8bff..4e30adec0 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -2750,6 +2750,10 @@ Finally Cody added [try.sh](2004/jdalbec/try.sh) and Cody reported that this entry cannot be optimised by the compiler as otherwise it will not work. +Cody, out of an abundance of caution for clang, added a second arg to `main()` +as some versions complain about the number of args and although they accept 1 it +is entirely possible it will eventually be that they don't. + Cody also added the [try.sh](2004/kopczynski/try.sh) script and various data files: [kopczynski-a](kopczynski-a) to demonstrate what happens when art more like a letter is fed to the program and the `kopczynski*-rev` files which are