From b4e46066a526e5c2f0c8292aa38196b7f16edd23 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Sat, 30 Sep 2023 11:46:36 -0700 Subject: [PATCH] 1988/reddy - fgets() to remove annoying warnings It redefines gets() to use fgets() so that the only change is an additional #define macro. Now the entry won't have an obnoxious warning at compiling, linking or runtime (the most annoying kind). --- 1988/reddy/reddy.c | 1 + thanks-for-fixes.md | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/1988/reddy/reddy.c b/1988/reddy/reddy.c index 09938c80d..26ea59f56 100644 --- a/1988/reddy/reddy.c +++ b/1988/reddy/reddy.c @@ -3,4 +3,5 @@ #define w printf #define p while #define t(s) (W=T(s)) +#define gets(I) fgets((I), 99, stdin) char*X,*B,*L,I[99];M,W,V;D(){W==9?(w("`%.*s' is ",V,X),t(0)):W==40?(t(0),D(),t(41)):W==42?(t(0),D(),w("ptr to ")):0;p(W==40?(t(0),w("func returning "),t(41)):W==91?(t(0)==32?(w("array[0..%d] of ",atoi(X)-1),t(0)):w("array of "),t(93)):0);}main(){p(w("input: "),B=gets(I))if(t(0)==9)L=X,M=V,t(0),D(),w("%.*s.\n\n",M,L);}T(s){if(!s||s==W){p(*B==9||*B==32)B++;X=B;V=0;if(W=isalpha(*B)?9:isdigit(*B)?32:*B++)if(W<33)p(isalnum(*B))B++,V++;}return W;} diff --git a/thanks-for-fixes.md b/thanks-for-fixes.md index 09cf3e78b..b8dacf403 100644 --- a/thanks-for-fixes.md +++ b/thanks-for-fixes.md @@ -272,6 +272,11 @@ changing `main()` to call the new function `pain()` (chosen because it's a pain that clang requires these args to be `char **` :-) ) with the correct args it now works. +## [1988/reddy](1988/reddy/reddy.c) ([README.md](1988/reddy/README.md)) + +Cody made this use `fgets()` to prevent annoying warnings during compiling, +linking and runtime, the latter of which being the most annoying. + ## [1988/spinellis](1988/spinellis/spinellis.c) ([README.md](1988/spinellis/README.md]))