home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / modu1096.zip / GPMsym / shellpipes.def < prev    next >
Text File  |  1996-08-29  |  2KB  |  49 lines

  1. (****************************************************************)
  2. (*                                                              *)
  3. (*         Gardens Point Modula-2 Library Definition            *)
  4. (*                                                              *)
  5. (*                                                              *)
  6. (*     (c) Copyright 1996 Faculty of Information Technology     *)
  7. (*              Queensland University of Technology             *)
  8. (*                                                              *)
  9. (*     Permission is granted to use, copy and change this       *)
  10. (*     program as long as the copyright message is left intact  *)
  11. (*                                                              *)
  12. (****************************************************************)
  13.  
  14. FOREIGN DEFINITION MODULE ShellPipes;
  15.   IMPORT IMPLEMENTATION FROM "shellpipes.o";
  16.  
  17.   FROM UxFiles IMPORT File;
  18.  
  19.   PROCEDURE PipeInput(command : ARRAY OF CHAR;
  20.           VAR stream  : File;
  21.           VAR opened  : BOOLEAN);
  22.   (* An input stream is returned, or opened is retured false   *)
  23.   (* The standard output of the shell command is piped to the  *)
  24.   (* stream, where it may be read by standard input operations *)
  25.  
  26.   PROCEDURE PipeOutput(command : ARRAY OF CHAR;
  27.            VAR stream  : File;
  28.            VAR opened  : BOOLEAN);
  29.   (* An output stream is returned, or opened is retured false  *)
  30.   (* Output to the stream is piped as standard input to the    *)
  31.   (* specified shell command                       *)
  32.  
  33.   PROCEDURE ClosePipe(stream : File);
  34.   (* closes the pipe associated with the specified stream      *)
  35.  
  36.   (* typical usage : 
  37.    *
  38.    *  FROM ShellPipes IMPORT PipeInput, ClosePipe;
  39.    *    ...
  40.    *    PipeInput("ls -1 *.def", inFile, ok);
  41.    *    IF ok THEN
  42.    *      WHILE NOT EndFile(inFile) DO
  43.    *        ...
  44.    *      END;
  45.    *      ClosePipe(inFile);
  46.    *    ELSE ...
  47.    *)
  48. END ShellPipes.
  49.