home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Connectivity / GateKeeper-2.1 / Subprocess.h < prev    next >
Encoding:
Text File  |  1997-03-04  |  2.2 KB  |  84 lines

  1. //************************************************************************
  2. //
  3. //    Most of this code is from the Subprocess object.  
  4. //    Numerous additions, deletions, changes and any bugs courtesy of:
  5. //
  6. //        Felipe A. Rodriguez        
  7. //
  8. //    Portions of this file were derived from:
  9. //    
  10. //            pppkill.c
  11. //            by Scott Hess
  12. //
  13. //            Subprocess.h    (v10)
  14. //            by Charles L. Oei
  15. //            pty support by Joe Freeman
  16. //            with encouragement from Kristofer Younger
  17. //            Subprocess Example, Release 2.0
  18. //            NeXT Computer, Inc.
  19. //
  20. //    This code is supplied "as is" the author makes no warranty as to its 
  21. //    suitability for any purpose.  This code is free and may be distributed 
  22. //    in accordance with the terms of the:
  23. //        
  24. //            GNU GENERAL PUBLIC LICENSE
  25. //            Version 2, June 1991
  26. //            copyright (C) 1989, 1991 Free Software Foundation, Inc.
  27. //             675 Mass Ave, Cambridge, MA 02139, USA
  28. //
  29. //************************************************************************
  30.  
  31. #import <objc/Object.h>
  32. #import <appkit/Application.h>
  33. #import <appkit/nextstd.h>
  34. #import <stdio.h>
  35.  
  36.  
  37. /*
  38.     This subprocess object sends/receives data to/from any UNIX
  39.     subprocess asynchronously (via vfork).
  40.     Its delegate, if any, will receive the following messages:
  41.  
  42.     - subprocessDone;
  43.         // sent when the subprocess exits
  44.     
  45.     - subprocessOutput:(char *)buffer;
  46.         // sent whenever there is data on the standard output pipe;
  47.         // buffer is only valid until next call
  48.     
  49.     - showAlert:(const char *)errorString;
  50.         // sent when an error occurs;
  51.         // if it ever happens, it's usually only at startup time
  52. */
  53.  
  54.  
  55. #define BUFFERSIZE 2048
  56.  
  57. @interface Subprocess:Object
  58. {
  59.     FILE *fpToChild;
  60.     int fromChild;
  61.     int childPid;
  62.     id  delegate;
  63.     int masterPty;    // file descriptor for master/slave pty
  64.     int slavePty;
  65.     int bufferCount;
  66.     char outputBuffer[BUFFERSIZE];
  67.     int log;
  68.     FILE *fp;
  69.     char Path[MAXPATHLEN + 1];        // generic buffer to hold paths
  70. }
  71.  
  72.         // optional redirecting the standard error stream thru standard output
  73. - init:(const char *)subprocessString withDelegate:theDelegate     
  74.             andStdErr:(BOOL)wantsStdErr;
  75.  
  76. - terminate:sender;        // forces the subprocess to terminate (w/ SIGTERM)
  77.  
  78.         // read pppd/syslog output from a FIFO or an ordinary file
  79. - readFromFile;
  80. - readFromFIFO;
  81.  
  82.  
  83. @end
  84.