From e8eaf9ebd9bac7a40af2d6aac3eb58d0e66d04e5 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 10 Feb 2023 08:46:47 -0800 Subject: [PATCH] Get 1984/lycklama to compile To get it to compile we have to pass to the compiler -include unistd.h. To get it to compile without warnings we had to add -Wno-parentheses to the compiler invocation. Updated the README to include an example invocation (using the program source itself) as the old way no longer works (typing in long lines directly). Removed some comments that turn out to not be true (it does not need a K&R compiler for instance). --- 1985/lycklama/.gitignore | 1 + 1985/lycklama/Makefile | 5 ++--- 1985/lycklama/README.md | 11 +++++++---- 1985/lycklama/lycklama.c | 24 ++++++++++++------------ 4 files changed, 22 insertions(+), 19 deletions(-) create mode 100644 1985/lycklama/.gitignore diff --git a/1985/lycklama/.gitignore b/1985/lycklama/.gitignore new file mode 100644 index 000000000..57b8242ed --- /dev/null +++ b/1985/lycklama/.gitignore @@ -0,0 +1 @@ +lycklama diff --git a/1985/lycklama/Makefile b/1985/lycklama/Makefile index 63d0db4c9..3e3464132 100644 --- a/1985/lycklama/Makefile +++ b/1985/lycklama/Makefile @@ -340,7 +340,7 @@ CWARN= -Wall -Wextra -pedantic ${CSILENCE} # Silence warnings that ${CWARN} would normally complain about # -CSILENCE= -Wno-implicit-int -Wno-unused-value +CSILENCE= -Wno-implicit-int -Wno-unused-value -Wno-parentheses #CSILENCE= -Wno-implicit-int # compiler standard @@ -368,7 +368,7 @@ CDEFINE= # include files that are needed to compile # -CINCLUDE= +CINCLUDE=-include unistd.h #CINCLUDE= -include stdlib.h #CINCLUDE= -include stdio.h #CINCLUDE= -include stdlib.h -include stdio.h @@ -442,7 +442,6 @@ all: ${DATA} ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: This entry uses non-standard args to main() that do not work with modern compilers." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1985/lycklama/README.md b/1985/lycklama/README.md index 4f393c02d..8c016d501 100644 --- a/1985/lycklama/README.md +++ b/1985/lycklama/README.md @@ -10,12 +10,15 @@ NOTE: This entry uses non-standard args to main() that do not work with modern c ## Judges' comments: -Run the program without any arguments. Type in some very long lines -and notice how it redisplays it. +Run the program, redirecting a file into it, and notice how it redisplays it. +For instance try: -The program itself looks like tty noise. Notice that even 'define' in #define can be defined. + ./lycklama < lycklama.c + +The program itself looks like tty noise. In the past 'define' in `#define` could +even be defined but to get this to work on modern systems we had to change the +`#o` lines to `#define`. -NOTE: This entry requires a non-standard K&R C compiler to compile. Copyright (c) 1985, Landon Curt Noll & Larry Bassel. All Rights Reserved. Permission for personal, educational or non-profit use is diff --git a/1985/lycklama/lycklama.c b/1985/lycklama/lycklama.c index d7a3776fd..3bb0f7462 100644 --- a/1985/lycklama/lycklama.c +++ b/1985/lycklama/lycklama.c @@ -1,16 +1,16 @@ #define o define -#o ___o write -#o ooo (unsigned) -#o o_o_ 1 -#o _o_ char -#o _oo goto -#o _oo_ read -#o o_o for -#o o_ main -#o o__ if -#o oo_ 0 -#o _o(_,__,___)(void)___o(_,__,ooo(___)) -#o __o (o_o_<<((o_o_<<(o_o_<