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.
20 lines
1.0 KiB
C
20 lines
1.0 KiB
C
#define iv 4
|
|
#define v ;(void
|
|
#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(){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
|
|
= ++I)v)pipe(VI);cc=xi+cm++;for(V="jWYmDEnX";*V;V++)xi[*V^' ']=c,xi[*V++]
|
|
=c,c*=M,xi[*V^' ']=xi[*V]=c>>I;cc[-I]-=ix v)close(*VI);cc[M]-=M;}main(){
|
|
(*vi)();for(;v)write(VI[I],V,M));}l(xl,lx)char*lx;{v)printf(lx,xl)v)
|
|
fflush(stdout);}L(xx,V+I,(c-=X/cm,ix))int(*vi[])()={ii,li,LXX,LV,exit,l,
|
|
d,l,d,xv,MM,md,MC,ml,MV,xx,xx,xx,xx,MV,mi};
|