PTRAP(4)                                                 PTRAP(4)

          ptrap - plumber(4) filter

          ptrap port [!]regexp [ +attr [!]regexp ... ] ...

          Ptrap is a program that mounts itself over a plumber(4) ser-
          vice mounted at /mnt/plumb and filters incoming messages
          according to the rules provided on the command line.

          Ptrap accepts an arbitrary number of filters; each filter
          applies to a port, and may match over both the data and
          attributes of plumb messages.

          A filter is formatted as a port name, a data filter, and a
          list of attribute filters.

          The data filter is a regex(6) that matches the plumbed data.
          The attribute filter consists of the attribute name prefixed
          with a '+', followed by a regex(6) that matches the contents
          of the attribute.  Any regex may be prefixed with a '!' in
          order to negate a match, causing all matches for that regex
          to be discarded.  All parts of a filter must match in order
          for a plumb message to be forwarded.

          Start a sam(1) instance dedicated to editing kernel source

               ptrap edit '^/sys/src/9/'

          In another window, start a second sam(1) instance for all
          other editing jobs:

               ptrap edit '!^/sys/src/9/'

          Start an acme(1) instance instance dedicated to reading
          plumbed manual pages:

               ptrap edit '.*' +action '^showdata' +filename '^/man/'
               acme -c1


          plumber(4), plumb(6)

     Page 1                       Plan 9             (printed 5/22/22)

     PTRAP(4)                                                 PTRAP(4)

          Multiple filters specified on the same port ignore all but
          the last one.

          Ptrap would be more useful if it could inhibit sending the
          message to other clients.

          As far as plumber(4) is concerned, even messages dropped by
          ptrap are "accepted", which means rules that are supposed to
          apply to messages not accepted by clients are not invoked
          (e.g. a rule starting an editor if no one is listening to
          the edit port will not work if there is a ptrap on that

          Ptrap first appeared in 9front (February, 2018).

     Page 2                       Plan 9             (printed 5/22/22)