/***********************************************************************
* *
* 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;
int n, i;
terror("sfgetr failed1");
terror("sfgetr should have failed because of locking");
sfread(f,s,1);
terror("sfgetr failed2");
terror("sfgetr should have failed because of partial record");
terror("sfgetr should have succeeded getting partial record");
/* test type == -1 and type == 1 modes */
terror("sfgetr failed in compatible mode");
terror("sfgetr failed3");
terror("sfgetr should have failed due to locking");
sfread(f,s,0);
terror("sfgetr should have failed because record is incomplete");
terror("sfgetr failed in getting last partial record");
if(!(f = sftmp(0)) )
terror("Can't open temporary stream");
for(n = 0; n < 10; ++n) /* each record is 100 bytes */
{ for(i = 0; i < 100; ++i)
sfputc(f, 'a');
sfputc(f,'\n');
}
terror("Can't get a record");
n = 80;
if((i = sfmaxr(0, 0)) != n)
terror("maxr is %d, expected %d", i, n);
terror("Shouldn't have gotten a record");
n = 0;
if((i = sfmaxr(0, 0)) != n)
terror("maxr is %d, expected %d", i, n);
terror("Can't get a record");
terror("Can't get a record");
texit(0);
}