Improve my fix to 2000/anderson - redefine gets()

This commit is contained in:
Cody Boone Ferguson committed 2023-09-11 06:19:44 -07:00
1 parent 8aad81aaeb
commit 88eef478aa
2 files changed
+9 -10

No files matched your search

+7 -10
View File
@@ -1,5 +1,5 @@
#include <stdio.h>
#define gets(K) fgets((K)[1],1000,stdin)
char
*T="IeJKLMaYQCE]jbZRskc[SldU^V\\X\\|/_<[<:90!\"$434-./2>]s",
K[3][1000],*F,x,A,*M[2],*J,r[4],*g,N,Y,*Q,W,*k,q,D;X(){r [r
@@ -25,15 +25,12 @@ j((r[2]=0,R( ))
),r[1]-=q) &&
O(g-=-q) ;}
C(){( J=
fgets (K
[1],1000,stdin))&&C((B(g=K[2]),*r=!(!*r&&(*g++=0)),(*r)[r]=g
-K[2
],g=
K[2]
,r[1
]&&O
()))
;;}
gets (&K
[1]))&&C((B(g=K[2]),*r=!(!*r&&(*g++=0)),(*r)[r]=g-K[2],g=K[2
],r[
1]&&
O())
);;}
main
(){C
((l(
+2
View File
@@ -856,6 +856,8 @@ Cody changed this entry to use `fgets()` instead of `gets()` to make it safer
and to prevent annoying warnings from showing up at compiling, linking and/or
runtime, the latter interspersed with the output of the program.
Cody later improved the fix to use `gets()` by redefining `gets()` so that the
code looks like before.
## [2000/briddlebane](2000/briddlebane/briddlebane.c) ([README.md](2000/briddlebane/README.md]))