home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / ArchiveUtils / JumpBack / Source / Subprocess.h < prev    next >
Encoding:
Text File  |  1995-06-12  |  1.7 KB  |  63 lines

  1. /*
  2.     Subprocess.h    (v10)
  3.     by Charles L. Oei
  4.     pty support by Joe Freeman
  5.     with encouragement from Kristofer Younger
  6.     Subprocess Example, Release 2.0
  7.     NeXT Computer, Inc.
  8. */
  9.  
  10. #import <objc/Object.h>
  11. #import <stdio.h>
  12.  
  13. /*
  14.     This subprocess object sends/receives data to/from any UNIX
  15.     subprocess asynchronously (via vfork/pipe).
  16.     Its delegate, if any, will receive the following messages:
  17.  
  18.     - subprocessDone;
  19.         // sent when the subprocess exits
  20.     
  21.     - subprocessOutput:(char *)buffer;
  22.         // sent whenever there is data on the standard output pipe;
  23.         // buffer is only valid until next call
  24.     
  25.     - subprocessError:(const char *)errorString;
  26.         // sent when an error occurs;
  27.         // if it ever happens, it's usually only at startup time
  28. */
  29.  
  30. @interface Subprocess:Object
  31. {
  32.     FILE *fpToChild;
  33.     int fromChild;
  34.     int childPid;
  35.     id delegate;
  36. }
  37.  
  38. + new:(const char *)subprocessString;
  39.     // a cover for the below withDelegate:nil, andPtySupport:NO, andStdErr:YES
  40.  
  41. + new:(const char *)subprocessString
  42.     withDelegate:theDelegate
  43.     andPtySupport:(BOOL)wantsPty
  44.     andStdErr:(BOOL)wantsStdErr;
  45.     // optional requests for pseudo terminal support and
  46.     // redirecting the standard error stream thru standard output
  47.  
  48. - send:(const char *)string withNewline:(BOOL)wantNewline;
  49.     // send the string optionally followed by a new line
  50. - send:(const char *)string;
  51.     // sends the string followed by a new line
  52.     // shorthand for above withNewline:YES
  53. - terminateInput;
  54.     // sends an end-of-file (EOF) to the subprocess
  55.     // (and closes input pipe to child)
  56. - terminate:sender;
  57.     // forces the subprocess to terminate (w/ SIGTERM)
  58.  
  59. - setDelegate:anObject;
  60. - delegate;
  61.  
  62. @end
  63.