head 1.2; access; symbols SFIO_1999:1.1.1.1 SFIO_1998:1.1.1.1 SFIO_1997:1.1.1.1 ATT:1.1.1; locks; strict; comment @ * @; 1.2 date 99.09.11.12.42.12; author rse; state Exp; branches; next 1.1; 1.1 date 96.10.04.20.21.28; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.10.04.20.21.28; author rse; state Exp; branches; next ; desc @@ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @#include "sftest.h" int main() { Sfio_t* f; char buf[1024]; char* s; int fd[2]; close(0); if(pipe(fd) < 0 || fd[0] != 0) terror("Making pipe\n"); strcpy(buf,"1234567890"); if(!(f = sfopen(NIL(Sfio_t*),buf,"s"))) terror("Opening string stream\n"); if(!sfstack(f,sfstdin)) terror("Stacking\n"); if(write(fd[1],"ab",2) != 2) terror("Writing ab to pipe\n"); if(!(s = sfreserve(f,SF_UNBOUND,1)) || sfvalue(f) != 2) terror("Peeking size1 = %d but should be 2\n", sfvalue(f)); sfread(f,s,0); if(strncmp(s,"ab",2) != 0) terror("Wrong data1\n"); if(write(fd[1],"cd",2) != 2) terror("Writing cd to pipe\n"); close(fd[1]); if(!(s = sfreserve(f,4,0)) ) terror("Peeking size2 = %d but should be 4\n", sfvalue(f)); if(strncmp(s,"abcd",4) != 0) terror("Wrong data2\n"); if(!(s = sfreserve(f,10,0)) ) terror("Peeking size3 = %d but should be 10\n", sfvalue(f)); if(strncmp(s,"1234567890",10) != 0) terror("Wrong data3\n"); return 0; } @ 1.1 log @Initial revision @ text @d3 1 a3 1 main() @ 1.1.1.1 log @Import of Sfio1997 @ text @@