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.
This commit is contained in:
1 parent
bd1554d663
commit
a194ac6cb3
2 files changed
+6
-1
No files matched your search
+2
-1
@@ -3,11 +3,12 @@
|
||||
#define XI(xi)int xi[iv*'V'];
|
||||
#define L(c,l,i)c(){d(l);m(i);}
|
||||
#include <stdio.h>
|
||||
#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<i&&l(-c-c,
|
||||
"%d"),l(i,"+%d")):l(i,"(%d")):(c&&l(M,")"),l(*D,"%c")),c=i;c&&l(X,")"),l
|
||||
(-i,"%c");m(iv-!(i&I));}L(ml,V,'\f')li(){m(cm+!isatty(i=I));}ii(){m(c=cm
|
||||
|
||||
@@ -174,6 +174,10 @@ Though this could be partly remedied through redirecting `stderr` to `/dev/null`
|
||||
this would not truly resolve the problem either and in order to avoid the
|
||||
warning one would have to always redirect `stderr` to `/dev/null`.
|
||||
|
||||
Later Cody improved upon the `gets()`/`fgets()` change to make it more like the
|
||||
original by redefining `gets()` to use `fgets()` (with the correct args) so that
|
||||
the code can refer to `gets()` instead.
|
||||
|
||||
|
||||
## [1987/westley](1987/westley/westley.c) ([README.md](1987/westley/README.md]))
|
||||
|
||||
|
||||
Reference in new issue
Block a user