PTRAP(4)                                                 PTRAP(4)

     NAME
          ptrap - plumber(4) filter

     SYNOPSIS
          ptrap port [!]regexp [ port [!]regexp ...  ]

     DESCRIPTION
          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 argument pairs; each
          pair consists of a port name port and a regular expression
          regexp (see regexp(6)). Each incoming message that does not
          match regexp is discarded.  The regexp can be optionally
          prefixed by ! to indicate logical inversion (i.e. messages
          matching the regexp are discarded).

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

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

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

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

     SOURCE
          /sys/src/cmd/ptrap.c

     SEE ALSO
          plumber(4), plumb(6)

     BUGS
          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
          port).

     PTRAP(4)                                                 PTRAP(4)

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