/* ECP: FILEname=fig13_27.c */ /* 1*/ void /* 2*/ SetFiles( FullCommand *Buf ) /* 3*/ { /* 4*/ if( Buf->InFile[ 0 ] ) /* 5*/ if( freopen( Buf->InFile, "r", stdin ) == NULL ) /* 6*/ { /* 7*/ perror( Buf->InFile ); /* 8*/ _exit( 127 ); /* 9*/ } /*10*/ if( Buf->OutFile[ 0 ] ) /*11*/ if( freopen( Buf->OutFile, "w", stdout ) == NULL ) /*12*/ { /*13*/ perror( Buf->OutFile ); /*14*/ _exit( 127 ); /*15*/ } /*16*/ } /* 1*/ void /* 2*/ UsePipe( int Fd[ 2 ], int WhichEnd ) /* 3*/ { /* 4*/ dup2( Fd[ WhichEnd ], WhichEnd ); /* 5*/ close( Fd[ 0 ] ); /* 6*/ close( Fd[ 1 ] ); /* 7*/ }