unxfunc.inc 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {
  2. $Id$
  3. This file is part of the Free Component Library (FCL)
  4. Copyright (c) 1999-2000 by Peter Vreman
  5. Darwin temporary pclose/assignpipe implementation
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. Function PClose(Var F:file) : cint;
  13. var
  14. pl : ^cint;
  15. begin
  16. fpclose(filerec(F).Handle);
  17. { closed our side, Now wait for the other - this appears to be needed ?? }
  18. pl:=@(filerec(f).userdata[2]);
  19. pclose := WaitProcess(pl^);
  20. end;
  21. Function PClose(Var F:text) :cint;
  22. var
  23. pl : ^longint;
  24. begin
  25. fpclose(Textrec(F).Handle);
  26. { closed our side, Now wait for the other - this appears to be needed ?? }
  27. pl:=@(textrec(f).userdata[2]);
  28. pclose:= WaitProcess(pl^);
  29. end;
  30. // can't have oldfpccall here, linux doesn't need it.
  31. Function AssignPipe(var pipe_in,pipe_out:cint):cint; [public, alias : 'FPC_SYSC_ASSIGNPIPE'];
  32. {
  33. Sets up a pair of file variables, which act as a pipe. The first one can
  34. be read from, the second one can be written to.
  35. If the operation was unsuccesful, linuxerror is set.
  36. }
  37. var
  38. ret : longint;
  39. fdis : array[0..1] of cint;
  40. begin
  41. fdis[0]:=pipe_in;
  42. fdis[1]:=pipe_out;
  43. ret:=pipe(fdis);
  44. pipe_in:=fdis[0];
  45. pipe_out:=fdis[1];
  46. AssignPipe:=ret;
  47. end;
  48. {
  49. $Log$
  50. Revision 1.3 2005-03-25 22:53:39 jonas
  51. * fixed several warnings and notes about unused variables (mainly) or
  52. uninitialised use of variables/function results (a few)
  53. Revision 1.2 2005/02/14 17:13:22 peter
  54. * truncate log
  55. Revision 1.1 2005/02/13 21:47:56 peter
  56. * include file cleanup part 2
  57. Revision 1.1 2005/02/13 20:01:37 peter
  58. * include file cleanup
  59. }