man(1) Manual page archive


     PIPEFILE(1)                                           PIPEFILE(1)

     NAME
          pipefile - attach filter to file in name space

     SYNOPSIS
          pipefile [ -d ] [ -r command ] [ -w command ] file

     DESCRIPTION
          Pipefile uses bind(2) to attach a pair of pipes to file,
          using them to interpose filter commands between the true
          file and the simulated file that subsequently appears in the
          name space.  Option -r interposes a filter that will affect
          the data delivered to programs that read from file; -w
          interposes a filter that will affect the data written by
          programs to file. At least one command must be specified;
          pipefile will insert a cat(1) process in the other direc-
          tion.

          After pipefile has been run, the filters are established for
          programs that subsequently open the file; programs already
          using the file are unaffected.

          Pipefile opens the file twice, once for each direction.  If
          the file is a single-use device, such as /dev/mouse, use the
          -d flag to specify that the file is to be opened once, in
          ORDWR mode.

     EXAMPLES
          Simulate an old terminal:

               % pipefile -w 'tr a-z A-Z' /dev/cons
               % rc -i </dev/cons >/dev/cons >[2=1]
               % echo hello
               HELLO
               %

          Really simulate an old terminal:

               % pipefile -r 'tr A-Z a-z' -w 'tr a-z A-Z' /dev/cons
               % rc -i </dev/cons >/dev/cons >[2=1]
               % DATE
               THU OCT 12 10:13:45 EDT 2000
               %

     SOURCE
          /sys/src/cmd/pipefile.c

     SEE ALSO
          mouse(8)

     BUGS

     PIPEFILE(1)                                           PIPEFILE(1)

          The I/O model of pipefile is peculiar; it doesn't work well
          on plain files.  It is really intended for use with continu-
          ous devices such as /dev/cons and /dev/mouse. Pipefile
          should be rewritten to be a user-level file system.

          If the program using the file managed by pipefile exits, the
          filter will see EOF and exit, and the file will be unusable
          until the name space is repaired.