From 9875ef3e6182bf61c9fb676aa7f871c3e4191733 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 17 Feb 2023 05:15:31 -0800 Subject: [PATCH] Get most 1993 entries to compile With the exception of lmfjyh which relies on a bug in gcc (that was fixed in gcc 2.3.3) we have got all 1993 entries to compile under linux. A couple will not compile under macOS and this is because gcc under macOS is actually clang despite what many might have you believe (see below) which is more strict about the second and third arguments of main(). In a couple entries we used patches from Yusuke Endoh. Thank you Yusuke! In others we (that is I aka Cody / @xexyl) fixed them (myself). There was a question to be answered about whether to add #include lines to the files themselves or add -includes to the Makefile. Since there are pending changes to the Makefiles which will affect the CFLAGS (and there's no CINCLUDE variable in these Makefiles yet) we opted for updating the source files themselves. One more note about the Makefiles: the 1993/Makefile was modified but I added an XXX note to it to indicate that it should be fixed once the other Makefiles are fixed. Specifically it now allows from 1993 one to run `make' and compile the entries. The comment has what it used to read and should be but for now is not because of a problem in the other Makefiles. As far as gcc under macOS as you can see it is not actually gcc but clang: $ /usr/bin/gcc -v 2>&1|head -n 1 Apple clang version 14.0.0 (clang-1400.0.29.202) If you were to use clang -v under linux you might see something like: $ clang -v 2>&1|head -n 1 clang version 15.0.7 (Fedora 15.0.7-1.fc37) and with gcc: $ gcc --version |head -n 1 gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4) If you do by chance have gcc compiled and installed under macOS these entries will probably work there. --- 1993/.gitignore | 13 +++++++++++++ 1993/Makefile | 7 ++++++- 1993/ant/Makefile | 2 +- 1993/cmills/cmills.c | 1 + 1993/dgibson/README.md | 8 +++++++- 1993/dgibson/dgibson.sh | 2 +- 1993/ejb/Makefile | 2 +- 1993/jonth/README.md | 2 ++ 1993/jonth/jonth.c | 8 +++++--- 1993/leo/README.md | 33 +++++++++++++++++++++++++-------- 1993/leo/leo.c | 5 +++-- 1993/lmfjyh/README.md | 6 ++++-- 1993/plummer/Makefile | 2 +- 1993/rince/rince.c | 4 ++-- 1993/schnitzi/Makefile | 2 +- 1993/schnitzi/README.md | 11 +++++++++-- 1993/schnitzi/schnitzi.c | 4 ++++ 1993/vanb/README.md | 5 +++++ 1993/vanb/vanb.c | 1 + 19 files changed, 92 insertions(+), 26 deletions(-) create mode 100644 1993/.gitignore mode change 100644 => 100755 1993/dgibson/dgibson.sh diff --git a/1993/.gitignore b/1993/.gitignore new file mode 100644 index 000000000..719efe2c0 --- /dev/null +++ b/1993/.gitignore @@ -0,0 +1,13 @@ +ant/ant +cmills/cmills +dgibson/data.name +dgibson/data.name2 +dgibson/life.d +ejb/ejb +jonth/jonth +jonth/jonth.tmp.c +leo/leo +plummer/plummer +rince/rince +schnitzi/schnitzi +vanb/vanb diff --git a/1993/Makefile b/1993/Makefile index 95d58850d..4763804c9 100644 --- a/1993/Makefile +++ b/1993/Makefile @@ -66,13 +66,18 @@ YEAR= 1993 # build all entries ################### # + +# XXX the $(MAKE) $$i is a temporary workaround while we get the entry Makefiles +# in order. It should read: +# +# (cd $$i && $(MAKE) $$i): all: @echo '=-=-= ${YEAR} begin make $@ =-=-=' @echo @for i in ${WINNERS} ; do \ echo "=-= start ${YEAR}/$$i =-="; \ echo "(cd $$i && $(MAKE) $@)"; \ - (cd $$i && $(MAKE) $@); \ + (cd $$i && $(MAKE) $$i); \ echo "=-= end ${YEAR}/$$i =-="; \ echo; \ done diff --git a/1993/ant/Makefile b/1993/ant/Makefile index daa03a5ec..ffb01811e 100644 --- a/1993/ant/Makefile +++ b/1993/ant/Makefile @@ -28,7 +28,7 @@ LN=ln # #CFLAGS=-O -Xa #CFLAGS=-Xa -CFLAGS= -ansi +CFLAGS= -ansi -include stdlib.h #CFLAGS= # ANSI compiler diff --git a/1993/cmills/cmills.c b/1993/cmills/cmills.c index 84a726875..6a395d4fb 100644 --- a/1993/cmills/cmills.c +++ b/1993/cmills/cmills.c @@ -1,6 +1,7 @@ long z[7992],W,H,*t=z,j,k,*T=z,n,b; #include +#include Window*E,D,s,w[999],*e=w; Display*d; Pixmap diff --git a/1993/dgibson/README.md b/1993/dgibson/README.md index 2f6c00550..39b5a981e 100644 --- a/1993/dgibson/README.md +++ b/1993/dgibson/README.md @@ -11,7 +11,7 @@ Best Abuse of the C Preprocessor: Judges' comments: - To use: + To build use: sh ./dgibson.sh [datafile] where: @@ -35,6 +35,12 @@ Judges' comments: Good luck trying to use a debugger on this entry! Life is not always pretty. + NOTE: we could not compile this entry under modern macOS but it will work + fine under linux. It likely fails to compile under macOS because its gcc is + actually just clang which is more strict about the type of the second argument + of main(). If you have gcc under macOS it might work just as well. We did not + test other systems. + Selected notes from the author: diff --git a/1993/dgibson/dgibson.sh b/1993/dgibson/dgibson.sh old mode 100644 new mode 100755 index 2bf351e6d..35bb9d8f0 --- a/1993/dgibson/dgibson.sh +++ b/1993/dgibson/dgibson.sh @@ -50,4 +50,4 @@ make dgibson # form the next generation # chmod +w life.d -dgibson | tee life.d +./dgibson | tee life.d diff --git a/1993/ejb/Makefile b/1993/ejb/Makefile index daa03a5ec..3b65d8e81 100644 --- a/1993/ejb/Makefile +++ b/1993/ejb/Makefile @@ -28,7 +28,7 @@ LN=ln # #CFLAGS=-O -Xa #CFLAGS=-Xa -CFLAGS= -ansi +CFLAGS= -ansi -include stdio.h -include stdlib.h -include string.h #CFLAGS= # ANSI compiler diff --git a/1993/jonth/README.md b/1993/jonth/README.md index d8693bd29..9a9c8b2f1 100644 --- a/1993/jonth/README.md +++ b/1993/jonth/README.md @@ -19,6 +19,8 @@ Judges' comments: This program's output may be even more obfuscated when played on inverse video. :-) + Yusuke Endoh provided a patch which allows this entry to compile on modern + systems. Thank you Yusuke! Selected notes from the author: diff --git a/1993/jonth/jonth.c b/1993/jonth/jonth.c index 654becc32..dc69e10ff 100644 --- a/1993/jonth/jonth.c +++ b/1993/jonth/jonth.c @@ -1,4 +1,5 @@ - G int i,j +#include + G long i,j K case R return 0 S( x,y) for(x=0; xkeycode,0);K 12:Y();}R;}d H 19;}M(J,4)}N H 20;}M(T,4)}q(m,w,k){ G=1;switch(k){ K 1:z+l]=1; d(m);R+1; diff --git a/1993/leo/README.md b/1993/leo/README.md index bae046f05..8fcbbb0fe 100644 --- a/1993/leo/README.md +++ b/1993/leo/README.md @@ -13,10 +13,10 @@ Judges' comments: make leo To have the computer guess: - leo [colors] + ./leo [colors] To guess the computer's number: - mind [colors] + ./mind [colors] where: colors number of possible colors (1 to 15) (default: 6) @@ -28,14 +28,31 @@ Judges' comments: We look forward to more entries from the newer members of the International Internet community. - On some systems, you may need to remove the line: + On more modern systems we had to make the following changes to get it to + compile: - #include - - or replace that line with: - #include - #include + --- i/1993/leo/leo.c + +++ w/1993/leo/leo.c + @@ -1,19 +1,20 @@ + #include + -#include + +#include + #include + +#include + + #define A(x) (e^d)&i?e:(e+=i+i/15-d,d<<=4,i<<=4,x) + #define B b+=!((e^d)&i)&&(d|=i),i<<=4, + #define C i=15,B B B B d=d<<4|d>>12, + #define D=(d=g,b=0,C b<<=4, C C C b) + #define E if(**y)goto + #define F=a[rand()%c] + #define G unsigned short + #define H e^=a[z],a[z]^=e,e^=a[z], + + -void + +int + to successfully build this entry. diff --git a/1993/leo/leo.c b/1993/leo/leo.c index ed90d56f9..ddc41acc2 100644 --- a/1993/leo/leo.c +++ b/1993/leo/leo.c @@ -1,6 +1,7 @@ #include -#include +#include #include +#include #define A(x) (e^d)&i?e:(e+=i+i/15-d,d<<=4,i<<=4,x) #define B b+=!((e^d)&i)&&(d|=i),i<<=4, @@ -11,7 +12,7 @@ #define G unsigned short #define H e^=a[z],a[z]^=e,e^=a[z], -void +int main (int z,char diff --git a/1993/lmfjyh/README.md b/1993/lmfjyh/README.md index c722bf7b0..d046dce94 100644 --- a/1993/lmfjyh/README.md +++ b/1993/lmfjyh/README.md @@ -16,8 +16,9 @@ Judges' comments: There's more than one way to get around disk quotas. :-) - Some people have reported problems compiling this entry - with gcc 2.3.3. + This entry will not compile on modern systems because it + relies on a compiler bug which was fixed in gcc 2.3.3 (a very + long time ago now). The make command: @@ -27,6 +28,7 @@ Judges' comments: make of lmfjyh. + Selected notes from the author: "Practical and efficient method of compressing source code" diff --git a/1993/plummer/Makefile b/1993/plummer/Makefile index daa03a5ec..7cf4c3579 100644 --- a/1993/plummer/Makefile +++ b/1993/plummer/Makefile @@ -28,7 +28,7 @@ LN=ln # #CFLAGS=-O -Xa #CFLAGS=-Xa -CFLAGS= -ansi +CFLAGS= -ansi -include stdio.h #CFLAGS= # ANSI compiler diff --git a/1993/rince/rince.c b/1993/rince/rince.c index 33e8bd2bb..fbf443aa6 100644 --- a/1993/rince/rince.c +++ b/1993/rince/rince.c @@ -50,7 +50,7 @@ x X l int _tty_ch; bool _echoit; bool _rawmode; -SGTTY _tty; +int _tty; #define U char #define G for( #define I )malloc(sizeof( @@ -71,7 +71,7 @@ j*a(int Q, int i) { (mvaddch(y,x,X[y][x]),++x^W-1)||(x=0,y++)); k=y=- --x; G - refresh(),c=select(k,&y,0,0,&v)?getch():0; + refresh(),c=select(k,&y,0,0,(v.tv_usec=1<<17,&v))?getch():0; k?++x-W||(x=1,++y-Q||(--k,x=W-1,y=Q-1)):--x||(y--,x=W-1),k|y; ) diff --git a/1993/schnitzi/Makefile b/1993/schnitzi/Makefile index daa03a5ec..847e4bd6a 100644 --- a/1993/schnitzi/Makefile +++ b/1993/schnitzi/Makefile @@ -28,7 +28,7 @@ LN=ln # #CFLAGS=-O -Xa #CFLAGS=-Xa -CFLAGS= -ansi +CFLAGS= -ansi -include stdlib.h -include string.h -include ctype.h #CFLAGS= # ANSI compiler diff --git a/1993/schnitzi/README.md b/1993/schnitzi/README.md index 91899a36c..39ba1b375 100644 --- a/1993/schnitzi/README.md +++ b/1993/schnitzi/README.md @@ -29,11 +29,18 @@ Judges' comments: Is it true that Elvis is alive? Do colorless green ideas sleep furiously? - NOTE: The author may also be contacted at: marks@aldrin.ksc.nasa.gov - We suggest you try using the body (minus the header and signature line) of a Usenet article. You might want to try something from alt.flame. :-) + If you have a ' in the question this entry may fail. + + NOTE: This entry uses `gets()` so you might get a warning when compiling and + running this entry. + + NOTE: this entry will likely segfault if you do not provide it with a data + file. + + NOTE: The author may also be contacted at: marks@aldrin.ksc.nasa.gov Selected notes from the author: diff --git a/1993/schnitzi/schnitzi.c b/1993/schnitzi/schnitzi.c index 24f9bf26f..584e752dc 100644 --- a/1993/schnitzi/schnitzi.c +++ b/1993/schnitzi/schnitzi.c @@ -1,4 +1,8 @@ #include +#include +#include +#include + #define iii\ ( I ) if ( ii(I,6\ ) )I [ strlen(I ) -1]=!1 diff --git a/1993/vanb/README.md b/1993/vanb/README.md index b8b6519f4..a0de4afda 100644 --- a/1993/vanb/README.md +++ b/1993/vanb/README.md @@ -31,6 +31,11 @@ Judges' comments: It is a good thing that this program consists of only one expression, otherwise it might become hard to understand. :-) + NOTE: we could not compile this entry under modern macOS but it will work + fine under linux. It likely fails to compile under macOS because its gcc is + actually just clang which is more strict about the type of the third + argument of main(). If you have gcc under macOS it might work just as well. + We did not test other systems. Selected notes from the author: diff --git a/1993/vanb/vanb.c b/1993/vanb/vanb.c index 98800e1d4..78c46342f 100644 --- a/1993/vanb/vanb.c +++ b/1993/vanb/vanb.c @@ -1,3 +1,4 @@ +#include 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>**