From 9264bcf0d148daa1331585d3b0f193606b4e2e65 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 24 Mar 2023 13:16:24 -0700 Subject: [PATCH] Fix 2013/cable3 for modern systems The code declares localtime() to be a different type than what time.h has which was included with macOS and thus it caused a compilation error. Instead use #undef localtime (I tried to remove the prototype and let time.h do its thing but this caused a segfault and since this works I opted for it .. for now at least). It also did not link in any system because it uses SDL functions that were removed from SDL2 so sdl-config has to be used instead of sdl2-config. --- 2013/cable3/Makefile | 4 ++-- 2013/cable3/README.md | 8 ++++++++ 2013/cable3/cable3.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/2013/cable3/Makefile b/2013/cable3/Makefile index 993d62724..490a4461e 100644 --- a/2013/cable3/Makefile +++ b/2013/cable3/Makefile @@ -107,7 +107,7 @@ CDEFINE= -DKB='(kb=read(H(8),r+1190,1))&&H(7)' #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h #CINCLUDE= -I ${X11_INCDIR} -I ${X11_INCDIR}/X11 -CINCLUDE= `${SDL2_CONFIG} --cflags` +CINCLUDE= `${SDL1_CONFIG} --cflags` # Optimization # @@ -131,7 +131,7 @@ CFLAGS= ${CSTD} ${CWARN} ${ARCH} ${CDEFINE} ${CINCLUDE} ${OPT} #LIBS= #LIBS= -lm #LIBS= -L ${X11_LIBDIR} -lX11 -LIBS= `${SDL2_CONFIG} --libs` +LIBS= `${SDL1_CONFIG} --libs` # C compiler to use # diff --git a/2013/cable3/README.md b/2013/cable3/README.md index 885a61e75..cf8378a5e 100644 --- a/2013/cable3/README.md +++ b/2013/cable3/README.md @@ -15,6 +15,14 @@ make ./cable3 bios-image-file floppy-image-file [harddisk-image-file] ``` +[Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this to compile +with modern systems. The problem is that `localtime()` is used differently and +`time.h` being included there was a conflicting function type. This appeared to +be a problem with macOS. The other problem is that this entry uses SDL functions +that were removed from SDL2 so the Makefile has to use `sdl-config` and not +`sdl2-config`. Thank you Cody for your assistance! + + ### Try: ```sh diff --git a/2013/cable3/cable3.c b/2013/cable3/cable3.c index 44a680f3f..96505d719 100644 --- a/2013/cable3/cable3.c +++ b/2013/cable3/cable3.c @@ -1,5 +1,5 @@ #include "SDL.h" - +#undef localtime #define $ for(O=9 #define CX M+=(T%3+2*!(!T*t-6)) #define x ,A=4*!T,O=t,W=h=T<3?u(Q?p:D(A+3),D(A),D(A+1)[i]+D(A+2)*g+):K(t),U=V=K(a),o?U=h,W=V:V,