1
0

pipefile 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. .TH PIPEFILE 1
  2. .SH NAME
  3. pipefile \- attach filter to file in name space
  4. .SH SYNOPSIS
  5. .B pipefile
  6. [
  7. .B -d
  8. ] [
  9. .B -r
  10. .I command
  11. ] [
  12. .B -w
  13. .I command
  14. ]
  15. .I file
  16. .SH DESCRIPTION
  17. .I Pipefile
  18. uses
  19. .IR bind (2)
  20. to attach a pair of pipes to
  21. .IR file ,
  22. using them to
  23. interpose filter
  24. .I commands
  25. between the true file and the simulated file that subsequently
  26. appears in the name space.
  27. Option
  28. .B -r
  29. interposes a filter that will affect the data delivered to programs that read from
  30. .IR file ;
  31. .B -w
  32. interposes a filter that will affect the data written by programs to
  33. .IR file .
  34. At least one
  35. .I command
  36. must be specified;
  37. .I pipefile
  38. will insert a
  39. .IR cat (1)
  40. process in the other direction.
  41. .PP
  42. After
  43. .I pipefile
  44. has been run, the filters are established for programs that subsequently
  45. open the
  46. .IR file ;
  47. programs already using the
  48. .I file
  49. are unaffected.
  50. .PP
  51. .I Pipefile
  52. opens the
  53. .I file
  54. twice, once for each direction. If the
  55. .I file
  56. is a single-use device, such as
  57. .BR /dev/mouse ,
  58. use the
  59. .B -d
  60. flag to specify that the file is to be opened once, in
  61. .B ORDWR
  62. mode.
  63. .SH EXAMPLES
  64. Simulate an old terminal:
  65. .EX
  66. .IP
  67. % pipefile -w 'tr a-z A-Z' /dev/cons
  68. % rc -i </dev/cons >/dev/cons >[2=1]
  69. % echo hello
  70. HELLO
  71. %
  72. .EE
  73. .PP
  74. Really simulate an old terminal:
  75. .EX
  76. .IP
  77. % pipefile -r 'tr A-Z a-z' -w 'tr a-z A-Z' /dev/cons
  78. % rc -i </dev/cons >/dev/cons >[2=1]
  79. % DATE
  80. THU OCT 12 10:13:45 EDT 2000
  81. %
  82. .EE
  83. .SH SOURCE
  84. .B /sys/src/cmd/pipefile.c
  85. .SH SEE ALSO
  86. .IR mouse (8)
  87. .SH BUGS
  88. The I/O model of
  89. .I pipefile
  90. is peculiar; it doesn't work well on plain files.
  91. It is really intended for use with continuous devices such as
  92. .I /dev/cons
  93. and
  94. .IR /dev/mouse .
  95. .I Pipefile
  96. should be rewritten to be a user-level file system.
  97. .PP
  98. If the program using the file managed by
  99. .I pipefile
  100. exits, the filter will see EOF and exit, and the file will be unusable
  101. until the name space is repaired.