head 1.3; access; symbols SFIO_1999:1.1.1.3 SFIO_1998:1.1.1.2 SFIO_1997:1.1.1.1 ATT:1.1.1; locks; strict; comment @ * @; 1.3 date 99.09.11.13.20.43; author rse; state Exp; branches; next 1.2; 1.2 date 99.09.11.12.42.11; author rse; state Exp; branches; next 1.1; 1.1 date 96.12.13.21.14.04; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.12.13.21.14.04; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 97.06.02.18.03.28; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 99.08.04.17.45.30; author rse; state Exp; branches; next ; desc @@ 1.3 log @Merge in Sfio 1999 changes @ text @#define sbrk ____sbrk____ #include "sftest.h" #undef sbrk _BEGIN_EXTERNS_ extern void* sbrk _ARG_((int)); _END_EXTERNS_ int main() { char *s = "1234567890\n"; Sfoff_t n, i; Sfio_t *f; char buf[1024]; char* addr; if(sfopen(sfstdout,Kpv[0],"w+") != sfstdout) terror("Opening output file\n"); for(i = 0; i < 10000; ++i) if(sfputr(sfstdout,s,-1) < 0) terror("Writing data\n"); if(!(f = sfopen((Sfio_t*)0,Kpv[1],"w"))) terror("Opening output file \n"); sfseek(sfstdout,(Sfoff_t)0,0); if((n = sfmove(sfstdout,f,(Sfoff_t)SF_UNBOUND,'\n')) != i) terror("Move %d lines, Expect %d\n",n,i); sfseek(sfstdout,(Sfoff_t)0,0); sfseek(f,(Sfoff_t)0,0); sfsetbuf(sfstdout,buf,sizeof(buf)); if((n = sfmove(sfstdout,f,(Sfoff_t)SF_UNBOUND,'\n')) != i) terror("Move %d lines, Expect %d\n",n,i); sfopen(sfstdin,Kpv[0],"r"); sfopen(sfstdout,Kpv[1],"w"); sfmove(sfstdin,sfstdout,(Sfoff_t)SF_UNBOUND,-1); if(!sfeof(sfstdin)) terror("Sfstdin is not eof\n"); if(sferror(sfstdin)) terror("Sfstdin is in error\n"); if(sferror(sfstdout)) terror("Sfstdout is in error\n"); sfseek(sfstdin,(Sfoff_t)0,0); sfseek(sfstdout,(Sfoff_t)0,0); sfsetbuf(sfstdin,buf,sizeof(buf)); addr = (char*)sbrk(0); sfmove(sfstdin,sfstdout,(Sfoff_t)((unsigned long)(~0L)>>1),-1); if((ssize_t)((char*)sbrk(0)-addr) > 16*(_Sfpage > 0 ? _Sfpage : SF_PAGE) ) terror("Too much space allocated in sfmove\n"); if(!sfeof(sfstdin)) terror("Sfstdin is not eof2\n"); if(sferror(sfstdin)) terror("Sfstdin is in error2\n"); if(sferror(sfstdout)) terror("Sfstdout is in error2\n"); rmkpv(); return 0; } @ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @d17 2 a18 2 if(sfopen(sfstdout,"xxx","w+") != sfstdout) terror("Opening output file xxx\n"); d23 2 a24 2 if(!(f = sfopen((Sfio_t*)0,"yyy","w"))) terror("Opening output file yyy\n"); d36 2 a37 2 sfopen(sfstdin,"xxx","r"); sfopen(sfstdout,"yyy","w"); d52 1 a52 1 if((size_t)((char*)sbrk(0)-addr) > 16*(_Sfpage > 0 ? _Sfpage : SF_PAGE) ) d62 1 a62 3 unlink("xxx"); unlink("yyy"); @ 1.1 log @Initial revision @ text @d9 1 a9 1 main() d27 1 a27 1 if((n = sfmove(sfstdout,f,(Sfoff_t)(-1),'\n')) != i) d33 1 a33 1 if((n = sfmove(sfstdout,f,(Sfoff_t)(-1),'\n')) != i) d38 1 a38 1 sfmove(sfstdin,sfstdout,-1,-1); d62 2 a63 1 system("rm xxx yyy"); @ 1.1.1.1 log @Import of Sfio1997 @ text @@ 1.1.1.2 log @Import of Sfio1998 @ text @d27 1 a27 1 if((n = sfmove(sfstdout,f,(Sfoff_t)SF_UNBOUND,'\n')) != i) d33 1 a33 1 if((n = sfmove(sfstdout,f,(Sfoff_t)SF_UNBOUND,'\n')) != i) d38 1 a38 1 sfmove(sfstdin,sfstdout,(Sfoff_t)SF_UNBOUND,-1); d62 1 a62 2 unlink("xxx"); unlink("yyy"); @ 1.1.1.3 log @Import of Sfio1999 @ text @d17 2 a18 2 if(sfopen(sfstdout,Kpv[0],"w+") != sfstdout) terror("Opening output file\n"); d23 2 a24 2 if(!(f = sfopen((Sfio_t*)0,Kpv[1],"w"))) terror("Opening output file \n"); d36 2 a37 2 sfopen(sfstdin,Kpv[0],"r"); sfopen(sfstdout,Kpv[1],"w"); d52 1 a52 1 if((ssize_t)((char*)sbrk(0)-addr) > 16*(_Sfpage > 0 ? _Sfpage : SF_PAGE) ) d62 3 a64 1 rmkpv(); @