head 1.3; access; symbols SFIO_1999:1.1.1.2 SFIO_1998:1.1.1.1 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.16.07; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.12.13.21.16.07; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 99.06.04.18.59.30; author rse; state Exp; branches; next ; desc @@ 1.3 log @Merge in Sfio 1999 changes @ text @#include "sftest.h" int main() { int fd[2]; Sfio_t *fr, *fw = NULL; char *s; int n, w; if(pipe(fd) < 0) terror("Can't open pipe\n"); if(!(fr = sfnew(NIL(Sfio_t*),NIL(Void_t*),(size_t)SF_UNBOUND,fd[0],SF_READ)) || !(fw = sfnew(NIL(Sfio_t*),NIL(Void_t*),(size_t)SF_UNBOUND,fd[1],SF_WRITE)) ) terror("Can't open pipe streams\n"); sfset(fr,SF_SHARE,1); if(sfopen(sfstdout,Kpv[0],"w") != sfstdout) terror("Can't open for write\n"); if(sfopen(sfstdin,Kpv[0],"r") != sfstdin) terror("Can't open for read\n"); for(n = 0; n < 100; ++n) if((w = sfwrite(fw,"123456789\n",10)) != 10) terror("Writing to pipe w=%d\n",w); if((n = (int)sfmove(fr,sfstdout,(Sfoff_t)100,'\n')) != 100) terror("sfmove failed n=%d\n", n); sfclose(sfstdout); for(n = 0; n < 100; ++n) { if(!(s = sfgetr(sfstdin,'\n',1)) ) terror("Can't read data\n"); if(strcmp(s,"123456789") != 0) terror("Wrong data\n"); } rmkpv(); return 0; } @ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @d18 4 a21 4 if(sfopen(sfstdout,"xxx","w") != sfstdout) terror("Can't open xxx for write\n"); if(sfopen(sfstdin,"xxx","r") != sfstdin) terror("Can't open xxx for read\n"); d33 1 a33 1 terror("Can`t read data from xxx\n"); d38 1 a38 1 unlink("xxx"); @ 1.1 log @Initial revision @ text @d3 1 a3 1 main() d6 1 a6 1 Sfio_t *fr, *fw; @ 1.1.1.1 log @Import of Sfio1997 @ text @@ 1.1.1.2 log @Import of Sfio1999 @ text @d18 4 a21 4 if(sfopen(sfstdout,Kpv[0],"w") != sfstdout) terror("Can't open for write\n"); if(sfopen(sfstdin,Kpv[0],"r") != sfstdin) terror("Can't open for read\n"); d33 1 a33 1 terror("Can't read data\n"); d38 1 a38 1 rmkpv(); @