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/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/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/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/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/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/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/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 88c54ed45..4e30adec0 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -1780,6 +1780,13 @@ more like the original entry this was done in the Makefile. Note that the alt code does not use `fgets(3)` but rather `gets(3)`. +## [1994/weisberg](1994/weisberg/weisberg.c) ([README.md](1994/weisberg/README.md])) + +Cody changed the Makefile to make this program more user friendly and easier to +use with other tools as well by making the program output not a space after each +number but rather a newline. + + ## [1994/westley](1994/westley/westley.c) ([README.md](1994/westley/README.md])) Cody converted the spoiler compiler options (provided by the author) to be @@ -1801,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])) @@ -1820,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])) @@ -1841,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. @@ -1965,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 @@ -1979,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 @@ -1997,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])) @@ -2035,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. @@ -2138,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])) @@ -2145,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. @@ -2707,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 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.