home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / dup / part01 / README < prev   
Encoding:
Text File  |  1993-01-29  |  1.7 KB  |  48 lines

  1. The Source
  2. ----------
  3.  
  4. This /dev/fd driver is loosely based on one written by Mike
  5. "Ford" Ditto for the AT&T UNIX pc.  This version runs on SCO
  6. XENIX 386, version 2.3+.  The install script included will
  7. configure the kernel, edit /usr/sys/conf/link_xenix, and build
  8. the new kernel and device files in /dev/fd.
  9.  
  10. Building the driver
  11. -------------------
  12.  
  13. To properly build everything, move the Makefile, dup.c and
  14. Install script into a new directory called /usr/sys/io/dup, and
  15. run make in that directory.  Then run Install.
  16.  
  17. What /dev/fd is
  18. ---------------
  19. The /dev/fd driver effectively allows you to specify an already-open
  20. file descriptor number where a path name is normally required. This
  21. allows a program that demands a path name to be used to process
  22. standard input or standard output by specifying /dev/fd/0 or /dev/fd/1,
  23. respectively.
  24.  
  25. /dev/stdin and /dev/sdtout are links to the respective entries in
  26. /dev/fd/.
  27.  
  28. This is primarily useful when running a poorly-written program that
  29. has no provision for using stdin/stdout.  For example:
  30.  
  31.     find . -cpio /dev/stdout | compress > /dev/rfp021
  32.  
  33. (The "-cpio" option of the "find" command demands a file name and
  34. normally can not write to standard output.  This example gives it
  35. the name "/dev/stdout" allowing it to be piped directly to compress
  36. rather than writing to a temporary file.)
  37.  
  38. Note that some programs which demand a file name do so because
  39. they must lseek(2) on the file, and thus will not work if told
  40. to process stdin and stdin is a pipe.
  41.  
  42. The most common use for the /dev/fd driver that I have found is
  43. for "process substitution" under the shell rc, and those
  44. versions of the Korn shell that support it.  For example, to
  45. use jove's "parse-error-file" function, you could say
  46.  
  47.     ; jove -p <{egrep -n funcName *.c}
  48.