head 1.3; access; symbols SFIO_1999:1.1.1.2 SFIO_1998: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 98.02.20.20.01.02; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 98.02.20.20.01.02; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 99.08.04.18.06.58; author rse; state Exp; branches; next ; desc @@ 1.3 log @Merge in Sfio 1999 changes @ text @#include "sftest.h" int main() { Sfio_t* f; char* s; char* string = "111\n222\n333"; f = sfopen(NIL(Sfio_t*),string,"s"); if(!(s = sfgetr(f,'\n',SF_STRING|SF_LOCKR)) || strcmp(s,"111") != 0) terror("sfgetr failed1\n"); if(sfgetr(f,'\n',0) != NIL(char*)) terror("sfgetr should have failed because of locking\n"); sfread(f,s,1); if(!(s = sfgetr(f,'\n',SF_STRING)) || strcmp(s,"222") != 0) terror("sfgetr failed2\n"); if((s = sfgetr(f,'\n',0)) != NIL(char*)) terror("sfgetr should have failed because of partial record\n"); if(!(s = sfgetr(f,0,SF_LASTR)) ) terror("sfgetr should have succeeded getting partial record\n"); /* test type == -1 and type == 1 modes */ sfseek(f,(Sfoff_t)0,0); if(!(s = sfgetr(f,'\n',1)) || strcmp(s,"111") != 0) terror("sfgetr failed in compatible mode\n"); if(!(s = sfgetr(f,'\n',SF_STRING|SF_LOCKR)) || strcmp(s,"222") != 0) terror("sfgetr failed3\n"); if(sfgetr(f,'\n',1) ) terror("sfgetr should have failed due to locking\n"); sfread(f,s,0); if(sfgetr(f,'\n',1) ) terror("sfgetr should have failed because record is incomplete\n"); if(!(s = sfgetr(f,0,-1)) || strcmp(s,"333") != 0) terror("sfgetr failed in getting last partial record\n"); return 0; } @ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @d43 1 a43 1 exit(0); @ 1.1 log @Initial revision @ text @d3 1 a3 1 main() @ 1.1.1.1 log @Import of Sfio1998 @ text @@ 1.1.1.2 log @Import of Sfio1999 @ text @d43 1 a43 1 return 0; @