/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1999-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "sftest.h"
tmain()
{
Sfio_t* f;
Sfio_t* g;
char* s;
int n, i;
terror("Can't open file to write");
terror("Can't open file to read1");
terror("Can't open file to read2");
terror("Wrong data1");
sfsync(f);
terror("Wrong data2");
sfsync(g);
terror("Wrong data3");
sfsync(f);
terror("Wrong data4");
sfsync(g);
sfclose(f);
sfclose(g);
terror("Can't open file to write2");
terror("Can't open file to read3");
terror("bad write1");
sfsync(f);
terror("Wrong data5");
sfsync(g);
terror("bad write2");
sfsync(f);
terror("Wrong data6");
sfsync(g);
terror("Can't open file to write3");
for(i = 0; i < sizeof(buf); ++i)
buf[i] = 0;
for(i = 0; i < 256; ++i)
terror("Writing buffer0");
for(i = 0; i < sizeof(buf); ++i)
buf[i] = 1;
for(i = 0; i < 256; ++i)
terror("Writing buffer1");
terror("Can't open file to read3");
for(n = 0; n < 256; ++n)
terror("Can't reserve buffer1");
for(i = 0; i < sizeof(buf); ++i)
if(s[i] != 0)
terror("Bad data1");
}
for(n = 0; n < 256; ++n)
terror("Can't reserve buffer2");
for(i = 0; i < sizeof(buf); ++i)
if(s[i] != 1)
terror("Bad data2");
}
if((s = sfreserve(f,1,0)) )
terror("Reading beyond eof");
terror("Can't open to write");
terror("Can't write");
sfclose(f);
terror("Can't open file as sfstdin");
terror("sfmove wrong number of lines %d",n);
terror("Can't seek back to 0");
terror("sfmove2 wrong number of lines %d",n);
terror("sfmove3 wrong number of lines %d",n);
texit(0);
}