/***********************************************************************
* *
* 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"
#if __STD_C
#else
Sfio_t* f;
size_t n;
#endif
{
}
#if __STD_C
#else
Sfio_t* f;
size_t n;
#endif
{
}
#if __STD_C
#else
Sfio_t* f;
int type;
#endif
{
}
tmain()
{
Sfio_t* f;
char* s;
int i;
alarm(10);
if(argc > 1)
{ /* coprocess only */
texit(0);
}
terror("Open coprocess");
terror("Write coprocess");
if(sftell(f) != 4)
terror("sftell1");
terror("Read coprocess");
if(sftell(f) != 8)
terror("sftell2");
terror("Write coprocess2");
if(sftell(f) != 12)
terror("sftell 3");
terror("Read coprocess2");
if(sftell(f) != 16)
terror("sftell 4");
sfclose(f);
/* the below tests to see if stream position is correct when
multiple disciplines are put on a stream.
*/
terror("Opening file to write");
for(i = 0; i < 100; ++i)
terror("Can't write out strings");
sfsync(f);
terror("Wrong position");
}
sfclose(f);
terror("Opening file to read");
for(i = 0; i < 100; ++i)
terror("Can't read string");
if(strcmp(s,"123456789") != 0)
terror("Wrong string");
terror("Wrong position");
}
sfclose(f);
terror("Opening file to read");
for(i = 0; i < 100; ++i)
terror("Can't read string");
if(strcmp(s,"123456789") != 0)
terror("Wrong string");
terror("Wrong position");
}
sfclose(f);
texit(0);
}