Plumbing rules tell
how to route plumbing messages
generated by applications using
The file is a set of rules separated by blank lines.
is a set of patterns followed by a set of actions.
The rules are interpreted in order.
The first rule whose patterns all match is applied, and no further
rules are examined.
Comments start with
and continue to end of line.
Single quotes protect special characters (use
to get a single quote).
has the general form:
- field verb arg
corresponds to a field in the incoming plumbing message:
- Source application
- Destination port
- Working directory
- Format of the data (eg,
- A line of
- The message data (an array of bytes)
The verbs are:
- Exact string comparison with
- Regular expression comparison with
must name an existing directory
must name an existing file
- Set the value of the
This verb operates in place, so put it after all other patterns in the rule.
can refer to one of the following variables:
- $0 to $9
- Substrings resulting from the most recent regular expression match:
is the entire substring;
the first parenthesised substring, etc.
- The file name examined by the last
- The directory name examined by the last
The following actions are provided:
- plumb to port
- Route the message to the given plumbing
- plumb start command arg ...
- If no program is currently listening on the current rule's
with the given arguments.
variables listed above can be used, to include part
of the message in the command line arguments to the program.
They are replaced in the command string by their actual values.
For example, the following rule sends the names of module files-
file names ending with suffix
starting it if it is not already running:
kind is text
data matches '([a-zA-Z0-9]+.m)(:[0-9]+)?'
data isfile /module/$1
data set /module/$0
plumb to edit
plumb start /dis/wm/brutus.dis $file$2
Note the use of
action to pass
the line number selected by the second parenthesised
expression in the pattern.