From 8aad81aaebe3d74efb1a8afa5267b6ee8363b715 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 11 Sep 2023 06:11:11 -0700 Subject: [PATCH] Improve my fix to 1993/schnitzi Redefined gets() so that the code can refer to gets() not fgets(). That change was useful (as noted before) for preventing an annoying warning being interspersed with the output and warnings at compiler and/or linking. --- 1993/schnitzi/schnitzi.c | 4 ++-- thanks-for-fixes.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/1993/schnitzi/schnitzi.c b/1993/schnitzi/schnitzi.c index 55c4232b3..e947800a6 100644 --- a/1993/schnitzi/schnitzi.c +++ b/1993/schnitzi/schnitzi.c @@ -2,7 +2,7 @@ #include #include #include - +#define gets(x) fgets((x), 111, stdin) #define iii\ ( I ) if ( ii(I,6\ ) )I [ strlen(I ) -1]=!1 @@ -30,6 +30,6 @@ ) printf ( " %s",li1[l1l++] ) ;puts ( "." ) ;}}else{sprintf ( il1,"cat %s;echo",lll[1] ) ;system ( il1 ) ;}printf -( "\n? " ) ; fgets ( il1, 111 , stdin +( "\n? " ) ; gets ( il1 ) ;sprintf ( i1l,"%s %s %s",lll[!1 ] ,lll[1],il1);system ( i1l); } diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 4e6bf7d2f..932410ceb 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -663,6 +663,8 @@ Cody made this use `fgets()` not `gets()` to make it safer and to prevent an annoying warning with compiling and/or linking and/or runtime, the latter of which is unfortunately interspersed with the output of the program itself. +Cody later improved the fix to use `gets()` via a macro so that it looks like +the original code. ## [1993/vanb](1993/vanb/vanb.c) ([README.md](1993/vanb/README.md]))