home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / AZTEC-C / AZPIPE11.ARK / AZPIPE11.DOC < prev    next >
Text File  |  1989-11-12  |  4KB  |  85 lines

  1.                           AZPIPE11.DOC
  2.  
  3.                            12 Nov. 89
  4.  
  5.  
  6. In the March, 1985, issue of Doctor Dobb's Journal, Allen Holub 
  7. described a tidy alteration to the Croot() function of Aztec C 
  8. for CP/M, version 1.05, which implemented pipes -- one of the 
  9. UNIX-like features which we all, in our insatiable hunger for 
  10. power, would like most to have.  Unfortunately, this was also 
  11. about the time when Manx came out with their version 1.06, which 
  12. had an array of new features, bug fixes, etc., and the disturbing 
  13. character that the source of the library was no longer part of 
  14. the package, as it had been, but cost an extra $150.  (It is 
  15. already stiff at the $200 base price.)  Croot() of v. 1.06 is 
  16. then inaccessible to Holub's modifications without significant 
  17. extra expense.
  18.  
  19.  
  20. So what azpipe.c does is implement piping apart from the Croot() 
  21. function.  Then it should be useful with any version which uses 
  22. the same structures (fcbtab and channel) for i/o and has the 
  23. library routines freopen() and execv().
  24.  
  25.  
  26. Pipes are set up by linking AZPIPE11.O into the programs which 
  27. are to be run with piping, having 'pipe_set(&argc,argv)' as the 
  28. first executable statement, and 'pipe_exec()' as the last 
  29. executable statement.  The files 'pipe.in' and 'pipe.out' are 
  30. used to redirect stdin and stdout, with appropriate housekeeping.  
  31. I actually redirect to out of the way user areas such as 
  32. '15/m:pipe.in' on a RAM drive, since everything is then much 
  33. faster.  'AZPIPE11.C' can be edited and recompiled as necessary 
  34. to accomodate this sort of thing.  A path search scheme can be 
  35. specified for each program after the first '|' character by 
  36. editing the 'path' array of strings and recompiling.  As it is 
  37. now, the path is '00/A:', '00/B:', '00/C:', '00/D:', and '00/E:'. 
  38.  
  39.  
  40. Without a doubt, the proper way to do this job is through the 
  41. operating system, rather than these program add-ons.  But the 
  42. price of an extra 4K in the size of typical filter programs 
  43. does not seem too much.
  44.  
  45.  
  46. On the command line, the '|' character is used to signify a pipe.  
  47. It must stand alone, with at least one space separating it from 
  48. programs and arguments.
  49.  
  50.      prog1 [args ...] | prog2 [args ...] | prog3 [args ...]
  51.  
  52. Stdin and stdout can be further redirected for the beginning and 
  53. the end of the sequence.
  54.  
  55.      prog1 [args] <input | prog2 [args] | prog3 [args] >output
  56.  
  57. Note that this redirection, since it is handled initially by the 
  58. "inaccessible" Croot() routine, can be specified at any position 
  59. of the command line, since Croot(), itself, does not know piping.  
  60. Initial stdin and stdout redirection is handled by Croot(), and 
  61. the 'pipe_set()' routine backtracks to determine whether stdout 
  62. has been redirected or not.  If so, pipe_set() takes over and 
  63. keeps track of the need to later redirect stdout at the tail of 
  64. the pipe sequence.  Anyway, the command line
  65.  
  66.      prog1 [args] <input >output | prog2 [args] | prog3 [args]
  67.  
  68. is then the functional equivalent of the previous command line. 
  69. In detail, this operation is accomplished by adding at the end 
  70. of the argument list an argument starting with a 'reserved' 
  71. character ('^'), which indicates to pipe_exec() that it is to 
  72. redirect stdout at the tail end of the piping. 
  73.  
  74. ***************************************************************** 
  75.  
  76. Version 1.1 fixes a couple of bugs and implements path searching 
  77. (very convenient) and ZCPR-style DU: specifications, as well as 
  78. preserving the Aztec-style U/D: protocol.
  79.  
  80.  
  81.  
  82. Bob Presswood
  83.  
  84. Inquiries via GENIE to R.PRESSWOOD
  85.