head 1.2; access; symbols SFIO_1999:1.1.1.1 SFIO_1998:1.1.1.1 SFIO_1997:1.1.1.1 ATT:1.1.1; locks; strict; comment @ * @; 1.2 date 99.09.11.12.42.11; author rse; state Exp; branches; next 1.1; 1.1 date 96.12.14.04.17.25; author rse; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 96.12.14.04.17.25; author rse; state Exp; branches; next ; desc @@ 1.2 log @Incorporate stuff from RSE's Sfio98 variant @ text @#include "sftest.h" #include static int Fd[2]; #if __STD_C static void alarmhandler(int sig) #else static void alarmhandler(sig) int sig; #endif { if(write(Fd[1],"01234\n56789\n",12) != 12) terror("Writing to pipe\n"); } int main() { char* s; char buf[1024]; if(pipe(Fd) < 0) terror("Can't make pipe\n"); if(sfnew(sfstdin,NIL(Void_t*),(size_t)SF_UNBOUND,Fd[0],SF_READ) != sfstdin) terror("Can't renew stdin\n"); sfset(sfstdin,SF_SHARE,1); if(sfpkrd(Fd[0],(Void_t*)buf,10,-1,1000,1) >= 0) terror("There isn't any data yet\n"); signal(SIGALRM,alarmhandler); alarm(2); if(!(s = sfgetr(sfstdin,'\n',1)) || strcmp(s,"01234") != 0) terror("Expecting 01234\n"); if(sfstdin->next < sfstdin->endb) terror("Sfgetr read too much\n"); if(!(s = sfgetr(sfstdin,'\n',1)) || strcmp(s,"56789") != 0) terror("Expecting 56789\n"); return 0; } @ 1.1 log @Initial revision @ text @d7 1 a7 1 void alarmhandler(int sig) d9 1 a9 1 void alarmhandler(sig) d17 1 a17 1 main() @ 1.1.1.1 log @Import of Sfio1997 @ text @@