tflags.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* 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;
terror("Can't open stream");
terror("Can't be eof or error yet");
if(sfgetc(f) != 'a')
terror("Got wrong data");
terror("Can't be eof or error yet2");
if(sfgetc(f) != 'b')
terror("Got wrong data2");
terror("Can't be eof or error yet3");
if(sfgetc(f) >= 0)
terror("Got wrong data2");
if(!sfeof(f))
terror("Should be eof now");
terror("Seek error");
if(sfeof(f))
terror("Shouldn't be eof any more");
terror("Can't open stream2");
terror("Can't be eof or error yet2");
terror("Can't write data");
terror("Can't seek back");
if(sfgetc(f) != 'a')
terror("Got wrong data3");
terror("Can't be eof or error yet4");
if(sfgetc(f) != 'b')
terror("Got wrong data4");
terror("Can't be eof or error yet5");
if(sfgetc(f) >= 0)
terror("Got wrong data5");
if(!sfeof(f))
terror("Should be eof now2");
terror("Seek error2");
if(sfeof(f))
terror("Shouldn't be eof any more2");
terror("sfmove failed");
if(!sfeof(f))
terror("f should be eof");
terror("sfstdout should not be in error");
texit(0);
}