/***********************************************************************
* *
* 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;
int type;
#endif
{
{ if(f != Fclose)
return -1;
terror("Stream should be open");
return 0;
}
terror("Stream mode should be accessible in exceptf");
return 0;
}
#if __STD_C
#else
Sfio_t* f;
size_t n;
#endif
{
terror("Stream mode should be inaccessible in readf");
return 0;
}
#if __STD_C
#else
Sfio_t* f;
size_t n;
#endif
{
terror("Stream mode should be inaccessible in writef");
return 0;
}
tmain()
{
int n;
terror("Opening file1");
terror("Opening file2");
terror("There should be no data n=%d",n);
terror("There should be no stack");
terror("Can't close f1");
tcleanup();
s1 = "1234567890";
s2 = "abcdefghijklmnopqrstuvwxyz";
s3 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
s4 = "!@#$%^&*()_-+={}[]~`':;?/><,|";
terror("Opening strings");
terror("Bad fd for stdin");
terror("Opening file");
terror("Write file");
terror("Seek file");
terror("Stacking on stdin2");
terror("Opening sfstdout");
terror("Bad sfmove");
tcleanup();
if(!(f = sftmp(0)))
terror("Opening temp file");
terror("Writing s4");
terror("Stacking s3");
terror("Stacking s2");
terror("Stacking s1");
terror("There shouldn't have been any new-line");
else
terror("Reading streams");
n = sfvalue(f);
if (ss[n])
ss[n] = 0;
}
#endif
terror("Opening strings2");
terror("Stacking streams2");
terror("Sfpeek1");
terror("Sfpeek2");
terror("Sfpeek3");
terror("Sfpeek4");
/* test to see if hidden read data still accessible */
terror("Can't create pipe");
terror("Can't create stream");
terror("Can't write to pipe");
terror("sfgetc failed");
/* hack to create hidden reserved buffer */
terror("Can't write to stream");
/* now stack stream */
terror("Can't open string stream");
terror("sfgetr failed");
if(strcmp(s, "1234abcd") != 0)
terror("sfgetr got wrong data");
texit(0);
}