From a194ac6cb3dab04fcc6499fa38b82762ffff5039 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Mon, 11 Sep 2023 05:51:47 -0700 Subject: [PATCH] Improve my original fix to 1987/wall This improvement redefines gets() to use fgets() with the correct args so that the code can refer to gets() to look more like the original code. Note that the prototype for gets() that is in the original code cannot be there because of conflicting types of fgets() and a couple other errors that arise from redefining gets(). This fix is part of issue #936 which with this commit is more than halfway complete. --- 1987/wall/wall.c | 3 ++- thanks-for-fixes.md | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/1987/wall/wall.c b/1987/wall/wall.c index 9aeadf78e..11a571ed7 100644 --- a/1987/wall/wall.c +++ b/1987/wall/wall.c @@ -3,11 +3,12 @@ #define XI(xi)int xi[iv*'V']; #define L(c,l,i)c(){d(l);m(i);} #include +#define gets(D) fgets((D),'x',stdin) int*cc,c,i,ix='\t',exit(),X='\n'*'\d';XI(VI)XI(xi)extern(*vi[])(),(* signal())();char*V,cm,D['x'],M='\n',I;L(MV,V,(c+='d',ix))m(x){v) signal(X/'I',vi[x]);}d(x)char*x;{v)write(i,x,i);}L(MC,V,M+I)xv(){c>=i?m( c/M/M+M):(d(&M),m(cm));}L(mi,V+cm,M)L(md,V,M)MM(){c=c*M%X;V-=cm;m(ix);} -LXX(){fgets(D,'x',stdin)||(vi[iv])();c=atoi(D);while(c>=X){c-=X;d("m");}V="ivxlcdm" +LXX(){gets(D)||(vi[iv])();c=atoi(D);while(c>=X){c-=X;d("m");}V="ivxlcdm" +iv;m(ix);}LV(){c-=c;while((i=cc[*D=getchar()])>-I)i?(c?(c