From 19fdd5f944a01cbcb7438ea852f8eaee4ef8ff09 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sun, 22 Oct 2023 12:52:42 -0700 Subject: [PATCH] Make my fix to 1993/vanb more like original Now it's just a single line difference: main() itself that calls O5() (which used to be main() via -DO5=main). This was accomplished by using the -include stdio.h in the Makefile and then removing (at the top of the file) the int O3. Instead main() (which used to be O5() as noted and which had three args) has it as a char **. Now since O3 was at file scope before it was 0 so rather than casting O3 in main() to an int the call to O5() just uses 0 in that place. The moving the arg to main() is done simply because O5() (which again was main()) also has 3 args. Some versions of clang object to four args to main() but they allow 0, 2 or 3 so that's fine. --- 1993/vanb/Makefile | 2 +- 1993/vanb/vanb.c | 6 ++---- thanks-for-fixes.md | 13 +++++++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/1993/vanb/Makefile b/1993/vanb/Makefile index 27c8156f2..1bfe5cc66 100644 --- a/1993/vanb/Makefile +++ b/1993/vanb/Makefile @@ -61,7 +61,7 @@ CDEFINE= # Include files that are needed to compile # -CINCLUDE= +CINCLUDE= -include stdio.h # Optimization # diff --git a/1993/vanb/vanb.c b/1993/vanb/vanb.c index 4fccf44a3..55d569274 100644 --- a/1993/vanb/vanb.c +++ b/1993/vanb/vanb.c @@ -1,6 +1,4 @@ -#include -int O3; -int O5(O2, O7, O3)char **O7;{return!(O2+=~01+01)?00:!(O2-=02>01)?printf("\045\157\012" +O5(O2,O7,O3)char**O7;{return!(O2+=~01+01)?00:!(O2-=02>01)?printf("\045\157\012" ,O5(012,O7+01,00)):!(O2-=02>>01)?(**O7<=067&&**O7>057?O5(03,O7,*(*O7)++-060+010 *O3):O3 ):!(O2 -=-O3- ~O3)? (072>** O7&&060 <=**O7 ?O5(04 ,O7,012 *O3-060 @@ -26,4 +24,4 @@ int O5(O2, O7, O3)char **O7;{return!(O2+=~01+01)?00:!(O2-=02>01)?printf("\045\15 ,O7,O5(06,O7, 00)):!( O2+=-02/ 02)?(!(* *O7-053)?O5(011,O7,O3+(++*O7,O5(010,O7,00))):!(055^**O7)?O5(011,O7,O3-(03+*(*O7 )++,O5(0010,O7,00))):O3):!(O2-=0563&0215)?O5(011,O7,O5(010,O7,00)):(++*O7,O3);} -main(O2,O7)char**O7;{return O5(O2,O7,O3);} +main(O2,O7,O3)char**O7,**O3;{return O5(O2,O7,0);} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 6bc1fbd69..558ecaf4c 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1050,8 +1050,17 @@ the original code. ## [1993/vanb](1993/vanb/vanb.c) ([README.md](1993/vanb/README.md])) Cody fixed this to work with clang. The problem was that the third arg to main() -was not a `char **`. Instead `O5()` (which was `main()`) is now its own function -which main() calls with the right parameters. +was not a `char **`. Instead `O5()` (which was `main()` via `-DO5=main`) is now +its own function which main() calls with the right parameters. + +Later Cody fixed it again to look much more like the original where only a +single line is added, that of `main()`, which calls `O5()`. This was done through +`-include stdio.h` at the compiler (in the Makefile) and by removing the `O3` +variable (an int) at the top of the file, instead making it a `char **` in +`main()` (`O5()` had three args) but then passing in `0` to `O5()` for the third +arg (as it was 0 at file scope already this is perfectly fine and it means +there's no need to cast it to an int in the function call though that would also +work). ## [1994/ldb](1994/ldb/ldb.c) ([README.md](1994/ldb/README.md]))