From c87f1e36fcb3976c0ebbdf11378818b5510ca91e Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 14 Apr 2023 05:42:15 -0700 Subject: [PATCH] Update 1994/ldb - remove alt code & update README The alt code served no purpose at all. Fixed formatting of README.md file. --- 1994/ldb/Makefile | 4 ++-- 1994/ldb/README.md | 32 ++++++++++---------------------- 1994/ldb/ldb.alt.c | 1 - 3 files changed, 12 insertions(+), 25 deletions(-) delete mode 100644 1994/ldb/ldb.alt.c diff --git a/1994/ldb/Makefile b/1994/ldb/Makefile index d22b3e1b1..23f03d9c9 100644 --- a/1994/ldb/Makefile +++ b/1994/ldb/Makefile @@ -111,8 +111,8 @@ OBJ= ${PROG}.o DATA= TARGET= ${PROG} # -ALT_OBJ= ${PROG}.alt.o -ALT_TARGET= ${PROG}.alt +ALT_OBJ= +ALT_TARGET= # FORCE use of -trigraphs # diff --git a/1994/ldb/README.md b/1994/ldb/README.md index 8df413f27..0f6a4d3f8 100644 --- a/1994/ldb/README.md +++ b/1994/ldb/README.md @@ -15,17 +15,16 @@ make all [Cody Boone Ferguson](/winners.html#Cody_Boone_Ferguson) fixed this so it would compile and work with modern compilers. The problem was that `srand()` returns void but it was used in a `||` expression. Thus the comma operator was needed. -Cody also changed the entry to use `fgets()` instead of `gets()` to make it -safe for lines greater than 231 in length and to prevent a warning at linking or -at runtime. Note that this now prints a newline after the output but this seems -like a worthy compromise for making it safer (fixing it is more problematic than -it is worth). In macOS another line of output would be shown anyway namely the -warning that it uses gets(). A subtlety about this fix: if a line is greater -than 231 in length if the program chooses that line it might print the first 231 -characters or it might print (up to) the next 231 characters and so on. Thank -you Cody for your assistance! - -For the original fixed version [ldb.alt.c](ldb.alt.c) see below. +Cody also changed the entry to use `fgets()` instead of `gets()` to make it safe +for lines greater than 231 in length and to prevent a warning at linking or at +runtime, the latter of which can be interspersed with output of the program. +Note that this now prints a newline after the output but this seems like a +worthy compromise for making it safer (fixing it is more problematic than it is +worth). In macOS another line of output would be shown anyway namely the warning +that it uses gets(). A subtlety about this fix: if a line is greater than 231 in +length if the program chooses that line it might print the first 231 characters +or it might print (up to) the next 231 characters and so on. Thank you Cody for +your assistance! ## To run: @@ -47,17 +46,6 @@ printf "The International Obfuscated C Code Contest\n by Laurion Burchall" | ./ldb ``` -### Alternate code: - -For the original version fixed so that it will compile with modern compiles, -try: - -```sh -make alt -``` - -Use `ldb.alt` as you would `ldb`. - ## Judges' remarks: Trigraphs are natural obfuscators. Most C-beautifiers become C-uglifiers diff --git a/1994/ldb/ldb.alt.c b/1994/ldb/ldb.alt.c deleted file mode 100644 index 9e7c492bf..000000000 --- a/1994/ldb/ldb.alt.c +++ /dev/null @@ -1 +0,0 @@ -int _,O,__??('}'??);main(){while(O?gets((rand()%O++?':':_)+__)||puts(&__??(_??))&_:(srand(time((O+++_))),0)||O);}