1{ 2 This file is part of the Free Pascal run time library. 3 Copyright (c) 2000 by Marco van de Voort 4 member of the Free Pascal development team. 5 6 See the file COPYING.FPC, included in this distribution, 7 for details about the copyright. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY;without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13**********************************************************************} 14 15{$ifndef HAS_LIBC_PIPING} 16Function PClose(Var F:file) : cint; 17var 18 pl : ^cint; 19 res : cint; 20 21begin 22 fpclose(filerec(F).Handle); 23{ closed our side, Now wait for the other - this appears to be needed ?? } 24 pl:=@(filerec(f).userdata[2]); 25 fpwaitpid(pl^,@res,0); 26 pclose:=res shr 8; 27end; 28 29Function PClose(Var F:text) :cint; 30var 31 pl : ^longint; 32 res : longint; 33 34begin 35 fpclose(Textrec(F).Handle); 36{ closed our side, Now wait for the other - this appears to be needed ?? } 37 pl:=@(textrec(f).userdata[2]); 38 fpwaitpid(pl^,@res,0); 39 pclose:=res shr 8; 40end; 41{$ENDIF} 42 43 44Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE']; 45{ 46 Sets up a pair of file variables, which act as a pipe. The first one can 47 be read from, the second one can be written to. 48 If the operation was unsuccesful, errno is set. 49} 50var 51 pip : tfildes; 52begin 53 assignPipe:=fppipe(pip); 54 pipe_in:=pip[0]; 55 pipe_out:=pip[1]; 56end; 57 58