head 1.3; access; symbols SFIO_1999:1.1.1.3 SFIO_1998:1.1.1.2 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.18.13.25.24; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.12.18.13.25.24; author rse; state Exp; branches; next 1.1.1.2; 1.1.1.2 date 97.03.07.00.20.06; author rse; state Exp; branches; next 1.1.1.3; 1.1.1.3 date 99.08.04.19.11.33; author rse; state Exp; branches; next ; desc @@ 1.3 log @Merge in Sfio 1999 changes @ text @ #if 0 #define _SFIO_H_ONLY 1 #include "sftest.h" /* This test causes mmap() to fail so that read() must be used. On a system such as BSDI, malloc uses mmap() so if mmap() fails, not much else will work. In such a case, we make this test automatically success. */ static Success = 1; #if __STD_C void* mmap(void* addr, size_t size, int x, int y, int z, Sfoff_t offset) #else void* mmap() #endif { if(Success) exit(0); return (void*)(-1); } #endif /* 0 */ int main() { #if 0 Sfio_t* f; char buf[1024], buf2[1024], *data; int n, r; #ifdef __FreeBSD__ return 0; #endif /* test to see if malloc() winds up calling mmap() */ if(!(data = (char*)malloc(8*1024)) ) terror("Malloc failed\n"); free(data); Success = 0; /* our real work */ if(!(f = sfopen(NIL(Sfio_t*), Kpv[0],"w")) ) terror("Can't open to write\n"); for(n = 0; n < sizeof(buf); ++n) buf[n] = '0' + (n%10); for(n = 0; n < 10; ++n) sfwrite(f,buf,sizeof(buf)); if(!(f = sfopen(f, Kpv[0],"r")) ) terror("Can't open to read\n"); for(n = 0; n < 10; ++n) { if((r = sfread(f,buf2,sizeof(buf))) != sizeof(buf)) terror("Bad read size=%d\n",r); if(strncmp(buf,buf2,sizeof(buf)) != 0) terror("Get wrong data\n"); } rmkpv(); #endif /* 0 */ return 0; } @ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @d7 7 a13 1 /* This test causes mmap() to fail so that read() must be used. */ d21 3 d33 1 a33 1 char buf[1024], buf2[1024]; d39 9 a47 3 if(!(f = sfopen(NIL(Sfio_t*),"xxx","w")) ) terror("Can't open xxx to write\n"); d55 2 a56 2 if(!(f = sfopen(f,"xxx","r")) ) terror("Can't open xxx to read\n"); d64 1 @ 1.1 log @Initial revision @ text @d1 4 a4 1 #define SFIO_H_ONLY 1 d18 3 a20 1 main() d22 1 d27 4 d49 1 a49 1 d52 1 @ 1.1.1.1 log @Import of Sfio1997 @ text @@ 1.1.1.2 log @Import of Sfio1998 @ text @d1 1 a1 1 #define _SFIO_H_ONLY 1 @ 1.1.1.3 log @Import of Sfio1999 @ text @d4 1 a4 7 /* This test causes mmap() to fail so that read() must be used. On a system such as BSDI, malloc uses mmap() so if mmap() fails, not much else will work. In such a case, we make this test automatically success. */ static Success = 1; a11 3 if(Success) exit(0); d18 1 a18 1 char buf[1024], buf2[1024], *data; d21 2 a22 9 /* test to see if malloc() winds up calling mmap() */ if(!(data = (char*)malloc(8*1024)) ) terror("Malloc failed\n"); free(data); Success = 0; /* our real work */ if(!(f = sfopen(NIL(Sfio_t*), Kpv[0],"w")) ) terror("Can't open to write\n"); d30 2 a31 2 if(!(f = sfopen(f, Kpv[0],"r")) ) terror("Can't open to read\n"); a39 1 rmkpv(); @