tpipe.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"
static int line;
#if __STD_C
#else
int sig;
#endif
{
}
tmain()
{
int fd[2];
char *s;
int i, j, n, to;
char buf[1024];
terror("Reopen sfstdout");
terror("Can't open pipe");
terror("Can't open stream");
if(to)
alarm(4);
}
terror("Can't read data from pipe");
terror("sfmove failed");
if(to)
alarm(0);
terror("Can't open pipe2");
terror("Can't open stream");
if(to)
alarm(4);
terror("sfwrite failed");
i = j = -1;
terror("sfscanf failed");
terror("sfscanf failed");
if(to)
alarm(0);
if(to)
alarm(4);
terror("sfwrite failed");
terror("sfreserve failed");
if(to)
alarm(0);
if(to)
alarm(4);
terror("sfmove failed");
terror("sfgetr failed");
if(to)
alarm(0);
if(to)
alarm(4);
terror("Bad write to pipe");
terror("sfgetr failed");
if(to)
alarm(0);
if(strcmp(s,"111"))
terror("sfgetr got wrong string");
if(to)
alarm(4);
terror("sfmove failed");
terror("sfmove got wrong data");
terror("sfmove failed");
if(to)
alarm(0);
if(to)
alarm(4);
terror("Bad write to pipe2");
if(to)
alarm(0);
terror("Bad peek str %s",s);
/* test for handling pipe error */
terror("Can't create pipe");
terror("Can't open stream");
for(i = 0; i < sizeof(buf); ++i)
buf[i] = 'a';
for(i = 0; i < 3; ++i)
{ if(to)
alarm(4);
}
if(to)
alarm(0);
}
texit(0);
}