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.
This commit is contained in:
Cody Boone Ferguson committed 2023-10-22 13:02:57 -07:00
1 parent 3ce5a603e9
commit 19fdd5f944
3 files changed
+14 -7

No files matched your search

+1 -1
View File
@@ -61,7 +61,7 @@ CDEFINE=
# Include files that are needed to compile
#
CINCLUDE=
CINCLUDE= -include stdio.h
# Optimization
#
+2 -4
View File
@@ -1,6 +1,4 @@
#include <stdio.h>
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);}
+11 -2
View File
@@ -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]))