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.11; 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() { char buf[100]; Sfio_t *fp; int i; char *s; if(!(fp = sftmp(8))) terror("Can't open temp file\n"); sfset(fp,SF_LINE,1); for(i = 0; i < 1000; ++i) { sfsprintf(buf,sizeof(buf),"Number: %d",i); if(sfputr(fp,buf,'\n') <= 0) terror("Writing %s\n",buf); } sfseek(fp,(Sfoff_t)0,0); for(i = 0; i < 1000; ++i) { sfsprintf(buf,sizeof(buf),"Number: %d",i); if(!(s = sfgetr(fp,'\n',1))) terror("Reading %s\n",buf); if(strcmp(s,buf) != 0) terror("Input=%s, Expect=%s\n",s,buf); } sfseek(fp,(Sfoff_t)0,0); s = sfgetr(fp,'\0',1); if(s) terror("Expecting a null string\n"); s = sfgetr(fp,'\0',-1); if(!s) terror("Expecting a non-null string\n"); if(sfvalue(fp) != sfsize(fp)) terror("Wrong size\n"); return 0; } @ 1.1 log @Initial revision @ text @d3 1 a3 1 main() @ 1.1.1.1 log @Import of Sfio1997 @ text @@