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.10; author rse; state Exp; branches; next 1.1; 1.1 date 96.12.13.20.52.51; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.12.13.20.52.51; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 97.06.02.18.03.58; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 99.06.04.18.50.35; author rse; state Exp; branches; next ; desc @@ 1.3 log @Merge in Sfio 1999 changes @ text @#include "sftest.h" int main() { Sfio_t* f; if(!(f = sfopen(NIL(Sfio_t*),"ab","sr")) ) terror("Can't open stream\n"); if(sfeof(f) || sferror(f)) terror("Can't be eof or error yet\n"); if(sfgetc(f) != 'a') terror("Got wrong data\n"); if(sfeof(f) || sferror(f)) terror("Can't be eof or error yet2\n"); if(sfgetc(f) != 'b') terror("Got wrong data2\n"); if(sfeof(f) || sferror(f)) terror("Can't be eof or error yet3\n"); if(sfgetc(f) >= 0) terror("Got wrong data2\n"); if(!sfeof(f)) terror("Should be eof now\n"); if(sfseek(f,(Sfoff_t)(-1),2) != 1) terror("Seek error\n"); if(sfeof(f)) terror("Shouldn't be eof any more\n"); if(!(f = sfopen(NIL(Sfio_t*), Kpv[0], "w+")) ) terror("Can't open stream2\n"); if(sfeof(f) || sferror(f)) terror("Can't be eof or error yet2\n"); if(sfwrite(f,"ab",2) != 2) terror("Can't write data\n"); if(sfseek(f,(Sfoff_t)0,0) != 0) terror("Can't seek back\n"); if(sfgetc(f) != 'a') terror("Got wrong data3\n"); if(sfeof(f) || sferror(f)) terror("Can't be eof or error yet4\n"); if(sfgetc(f) != 'b') terror("Got wrong data4\n"); if(sfeof(f) || sferror(f)) terror("Can't be eof or error yet5\n"); if(sfgetc(f) >= 0) terror("Got wrong data5\n"); if(!sfeof(f)) terror("Should be eof now2\n"); if(sfseek(f,(Sfoff_t)(-1),2) != 1) terror("Seek error2\n"); if(sfeof(f)) terror("Shouldn't be eof any more2\n"); if(!(f = sfopen(NIL(Sfio_t*), Kpv[0],"w+")) ) terror("Reopening %s\n", Kpv[0]); sfwrite(f,"1234567890",10); sfseek(f,(Sfoff_t)0,0); if(sfopen(sfstdout, Kpv[1], "w") != sfstdout) terror("Opening %s\n", Kpv[1]); if(sfmove(f,sfstdout,(Sfoff_t)(-1),-1) != 10) terror("sfmove failed\n"); if(!sfeof(f)) terror("f should be eof\n"); if(sferror(sfstdout)) terror("sfstdout should not be in error\n"); rmkpv(); return 0; } @ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @d28 1 a28 1 if(!(f = sfopen(NIL(Sfio_t*),"xxx","w+")) ) d53 2 a54 2 if(!(f = sfopen(NIL(Sfio_t*),"xxx","w+")) ) terror("Reopening xxx\n"); d58 2 a59 2 if(sfopen(sfstdout,"yyy","w") != sfstdout) terror("Opening yyy\n"); d68 1 a68 2 unlink("xxx"); unlink("yyy"); @ 1.1 log @Initial revision @ text @d3 1 a3 1 main() d68 2 a69 1 system("rm xxx yyy >/dev/null 2>&1"); @ 1.1.1.1 log @Import of Sfio1997 @ text @@ 1.1.1.2 log @Import of Sfio1998 @ text @d68 1 a68 2 unlink("xxx"); unlink("yyy"); @ 1.1.1.3 log @Import of Sfio1999 @ text @d28 1 a28 1 if(!(f = sfopen(NIL(Sfio_t*), Kpv[0], "w+")) ) d53 2 a54 2 if(!(f = sfopen(NIL(Sfio_t*), Kpv[0],"w+")) ) terror("Reopening %s\n", Kpv[0]); d58 2 a59 2 if(sfopen(sfstdout, Kpv[1], "w") != sfstdout) terror("Opening %s\n", Kpv[1]); d68 2 a69 1 rmkpv(); @