home *** CD-ROM | disk | FTP | other *** search
/ World of A1200 / World_Of_A1200.iso / programs / system / apipe / readme < prev    next >
Text File  |  1995-02-27  |  5KB  |  139 lines

  1. ################################################################################
  2. #
  3. #   APipe-Handler for AmigaDOS 2.04 or higher.
  4. #
  5. #   Copyright (C) 1991 by Per Bojsen.  All Rights Reserved.
  6. #
  7. #   Permission is granted to any individual or institution to use, copy,
  8. #   modify, and distribute this software, provided that this complete
  9. #   copyright and permission notice is maintained, intact, in all copies
  10. #   and supporting documentation.
  11. #
  12. #   This software is provided on an "as is" basis without express or
  13. #   implied warranty.
  14. #
  15.  
  16. NOTE: See the CAVEAT section (3) for some important information on the
  17.       implementation of the APipe-Handler.
  18. NOTE: Update information is included at the end of this file.
  19.  
  20. This archive contains the source for the APipe-Handler.  The archive should
  21. include the following files:
  22.  
  23.         child.asm
  24.         pgmpipe.c
  25.         APipe-Handler_rev.h
  26.         APipe-Handler_rev.i
  27.         APipe-Handler_rev.rev
  28.         Makefile
  29.         Mountlist
  30.         README
  31.  
  32.  
  33. 1) Introduction
  34.  
  35. Some weeks ago I got a strange idea for a new kind of pipe handler.  Let's
  36. call it `APipe-Handler' and its DOS device name `APIPE:'.  The special
  37. thing about this handler is that it interprets the name after the prefix
  38. `APIPE:' as a command line to be executed.  If the `APIPE:<command line>'
  39. file is opened as MODE_OLDFILE the standard output from the command will be
  40. available for reading; if the file is opened as MODE_NEWFILE the command will
  41. get its standard input from the data written to the file.
  42.  
  43. Here's some examples on the usage of this pipe handler:
  44.  
  45.     1> search APIPE:alias list ; print the aliases containing list
  46.  
  47.     2> sort "APIPE:list nohead" CONSOLE: ; sorted list
  48.  
  49.     3> comm -12 "APIPE:grep list APIPE:alias" "APIPE:grep nohead APIPE:alias"
  50.  
  51.     4> status >"APIPE:grep uucico" ; does not work with SAS grep: use GNU!
  52.  
  53.     5> grep uucico APIPE:status
  54.  
  55. The first two examples show things that could be done in a shell that
  56. supported anonymous pipes `|' *if* the standard AmigaDOS utilities had the
  57. ability to read from their standard input.
  58.  
  59. The third example shows something that is impossible to do with `|' command
  60. line pipes, and requires several lines (or shells) with PIPE: (comm is a
  61. program from the GNU text utilities that prints line in common between to
  62. sorted files).
  63.  
  64. Example four and five should produce equivalent results.
  65.  
  66. Other possible uses of APIPE: is as a file to save to from an editor,
  67. i.e., you could prepare some script or data file and save it directly to
  68. the command/program from your editor.  Or you could insert the output
  69. from a command into the file you're editing.  The editor you're using does
  70. not need any special support for this besides the ability to save and
  71. load files :-)
  72.  
  73. One nice thing about this handler is that it allows for a really simple
  74. implememtation of the UNIX popen()/pclose() functions: just append the
  75. command line to `APIPE:' and call fopen() on this string;  pclose() is
  76. simply a wrapper around fclose().  This was the main reason I came up with
  77. the idea, BTW.
  78.  
  79.  
  80. 2) How to build APipe-Handler
  81.  
  82. The build instructions assume you have SAS/C 5.10.
  83.  
  84. Edit the Makefile to reflect your installation.  You may choose to
  85. activate the machine architecture macros if you have a faster processor.
  86.  
  87. After you have customized the Makefile, type run your make program
  88. to build the handler.
  89.  
  90.  
  91. 3) CAVEAT
  92.  
  93. The APipe-Handler needs to copy the environment of the requester process
  94. for the child process which runs the specified command line.  The enviroment
  95. includes the path, IO, current directory, shell variables, and aliases.
  96.  
  97. Unfortunately, there's currently no way to copy this environment safely
  98. which is safe under all circumstances.  The handler may fail if the process
  99. opening a file on the handler messes with its environment (like changing
  100. its path, changing shell variables, etc.) while the ACTION_FINDINPUT or
  101. ACTION_FINDOUTPUT packet is still pending.  Furthermore, the process
  102. must run with a higher or same priority than the handler process which
  103. normally runs at priority 5.
  104.  
  105. Since most programs seems to use the dos.library call Open() to open
  106. their files the caveat above is probably not a big problem in practice.
  107.  
  108. If you know of any program that might fall into the category covered by
  109. the caveat, please let me know.  I will try to convince Commodore to
  110. add some features to new versions of the OS that will make it possible
  111. to implement the APipe-Handler in a completely safe way.  This will be
  112. easier if many people use/need the APipe-Handler, so if you like the
  113. concept then give your friends a copy of it!
  114.  
  115. 4) Send bug reports (and praise/support) to
  116.  
  117.         bojsen@moria.dc.dth.dk
  118.  
  119.    Snail mail:
  120.  
  121.         Per Bojsen
  122.         Maglegaards Alle 51 st. th.
  123.         DK-2860 Soeborg
  124.         Denmark
  125.  
  126. 5) Release notes.
  127.  
  128.    37.2  First publically released version.
  129.    37.3  Now uses the UserShell when starting programs.
  130.    37.4  Fixed bug in handling multiple outstanding read packets at
  131.          EOF.  The bug caused the handler to wait forever.
  132.    37.5  Improved cloning of filehandles so that >> redirection and
  133.          mixed reading/writing between parent and child process work
  134.          better.
  135.  
  136.                                     --**--
  137.  
  138. End of README.
  139.