From 58f30bd65e2ecb59d6c75ac4521e40bc0211377e Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Fri, 7 Apr 2023 11:02:58 -0700 Subject: [PATCH] Add note about fgets() in 1990/tbr About why it's useful. It's a problem to keep gets() but it might be a problem to not keep it as well. Nevertheless with macOS the output of the alternative code (which probably should be deleted but this can happen another time) is confusing: $ ./tbr.alt $ warning: this program uses gets(), which is unsafe. [] The [] is the cursor on a blank line. The first line of output of the program (which is not supposed to have a newline) instead has the warning and then a newline appended to it. --- 1990/tbr/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/1990/tbr/README.md b/1990/tbr/README.md index 9724d5aee..9224eb261 100644 --- a/1990/tbr/README.md +++ b/1990/tbr/README.md @@ -23,8 +23,9 @@ make all modern compilers; `exit(3)` returns void but the function was used in a binary expression so this wouldn't even compile. Cody also changed the code to use `fgets()` instead of `gets()` so one would not get a warning about the use of -`gets()` at execution which was interspersed with the output. Thank you Cody for -your assistance! +`gets()` at linking time or execution, the latter case causing confusing output +due to the warning being interspersed with the program's output. Thank you Cody +for your assistance! For the original version with `gets()` see the alternate code section below.