From 15a62a83fccf00f7f6cb06709d5bb34c1af5620d Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 3 Apr 2023 04:30:58 -0700 Subject: [PATCH 1/2] Minor fixes to 1994/ldb Remove warning from Makefile that this entry uses gets() as this is no longer true. Update README.md pointing out that this will print a newline after the output. --- 1994/ldb/Makefile | 1 - 1994/ldb/README.md | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/1994/ldb/Makefile b/1994/ldb/Makefile index b94058465..1b8d8425f 100644 --- a/1994/ldb/Makefile +++ b/1994/ldb/Makefile @@ -132,7 +132,6 @@ all: data ${TARGET} supernova deep_magic magic charon pluto ${PROG}: ${PROG}.c - @echo "NOTE: this entry uses gets() so you might get a warning compiling and/or running this." ${CC} ${CFLAGS} $< -o $@ ${LIBS} # alternative executable diff --git a/1994/ldb/README.md b/1994/ldb/README.md index 756dbe126..02473a349 100644 --- a/1994/ldb/README.md +++ b/1994/ldb/README.md @@ -14,7 +14,10 @@ USA 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. Thank you Cody for your assistance! +safe for lines greater than 231 in length. 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). Thank you Cody for your +assistance! ## To run: From 5dea00159cc4e712fad4ea88fb2f4d6c7afbec37 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 3 Apr 2023 04:50:33 -0700 Subject: [PATCH 2/2] Add a subtlety to 1994/ldb/README.md I noted this subtlety in the log yesterday but it seems that it should be noted in the README.md too. As I noted: 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. --- 1994/ldb/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/1994/ldb/README.md b/1994/ldb/README.md index 02473a349..e247738cd 100644 --- a/1994/ldb/README.md +++ b/1994/ldb/README.md @@ -16,8 +16,10 @@ 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. 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). Thank you Cody for your -assistance! +(fixing it is more problematic than it is worth). 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: