101 lines · 1.8 KB · Text
RawDownload
.TH PIPEFILE 1.SH NAMEpipefile \- attach filter to file in name space.SH SYNOPSIS.B pipefile[.B -d] [.B -r.I command] [.B -w.I command].I file.SH DESCRIPTION.I Pipefileuses.IR bind (2)to attach a pair of pipes to.IR file ,using them tointerpose filter.I commandsbetween the true file and the simulated file that subsequentlyappears in the name space.Option.B -rinterposes a filter that will affect the data delivered to programs that read from.IR file ;.B -winterposes a filter that will affect the data written by programs to.IR file .At least one.I commandmust be specified;.I pipefilewill insert a.IR cat (1)process in the other direction..PPAfter.I pipefilehas been run, the filters are established for programs that subsequentlyopen the.IR file ;programs already using the.I fileare unaffected..PP.I Pipefileopens the.I filetwice, once for each direction.  If the.I fileis a single-use device, such as.BR /dev/mouse ,use the.B -dflag to specify that the file is to be opened once, in.B ORDWRmode..SH EXAMPLESSimulate an old terminal:.EX.IP% pipefile -w 'tr a-z A-Z' /dev/cons% rc -i </dev/cons >/dev/cons >[2=1]% echo helloHELLO%.EE.PPReally simulate an old terminal:.EX.IP% pipefile -r 'tr A-Z a-z' -w 'tr a-z A-Z' /dev/cons% rc -i </dev/cons >/dev/cons >[2=1]% DATETHU OCT 12 10:13:45 EDT 2000%.EE.SH SOURCE.B /sys/src/cmd/pipefile.c.SH SEE ALSO.IR mouse (8).SH BUGSThe I/O model of.I pipefileis peculiar; it doesn't work well on plain files.It is really intended for use with continuous devices such as.I /dev/consand.IR /dev/mouse ..I Pipefileshould be rewritten to be a user-level file system..PPIf the program using the file managed by.I pipefileexits, the filter will see EOF and exit, and the file will be unusableuntil the name space is repaired.