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.12; author rse; state Exp; branches; next 1.1; 1.1 date 96.12.13.20.55.42; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.12.13.20.55.42; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 99.08.04.19.14.10; author rse; state Exp; branches; next ; desc @@ 1.3 log @Merge in Sfio 1999 changes @ text @#include "sftest.h" #if __STD_C int main(int argc, char** argv) #else int main(argc, argv) int argc; char **argv; #endif { Sfio_t* f; char* s; if(argc > 1) { /* coprocess only */ while((s = sfgetr(sfstdin,'\n',0))) sfwrite(sfstdout,s,sfvalue(sfstdin)); exit(0); } if(!(f = sfpopen(NIL(Sfio_t*),sfprints("%s -p",argv[0]),"r+")) ) terror("Open coprocess\n"); if(sfwrite(f,"123\n",4) != 4) terror("Write coprocess\n"); if(sftell(f) != 4) terror("sftell1\n"); if(!(s = sfreserve(f,4,0)) || strncmp(s,"123\n",4) != 0 ) terror("Read coprocess\n"); if(sftell(f) != 8) terror("sftell2\n"); sfset(f,SF_SHARE,1); if(sfwrite(f,"123\n",4) != 4) terror("Write coprocess2\n"); if(sftell(f) != 12) terror("sftell 3\n"); if(!(s = sfreserve(f,4,0)) || strncmp(s,"123\n",4) != 0 ) terror("Read coprocess2\n"); if(sftell(f) != 16) terror("sftell 4\n"); sfclose(f); return 0; } @ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @d46 2 @ 1.1 log @Initial revision @ text @d4 1 a4 1 main(int argc, char** argv) d6 1 a6 1 main(argc, argv) d16 1 a16 1 while(s = sfgetr(sfstdin,'\n',0)) @ 1.1.1.1 log @Import of Sfio1997 @ text @@ 1.1.1.2 log @Import of Sfio1999 @ text @d16 1 a16 1 while((s = sfgetr(sfstdin,'\n',0)) ) a44 2 sfclose(f); @