mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-08 01:20:40 +00:00
Sometimes, it's useful to export the entire line to an external
program without listening to the devd socket for all events. Define two new pseudo variables $*, the entire event from devctl and $_, the entire event without the type character, since it might be easier to use in some circumstances.
This commit is contained in:
parent
579a636f2a
commit
b3d322926d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297331
|
@ -648,8 +648,8 @@ config::expand_one(const char *&src, string &dst)
|
|||
return;
|
||||
}
|
||||
|
||||
// $[^A-Za-z] -> $\1
|
||||
if (!isalpha(*src)) {
|
||||
// $[^-A-Za-z_*] -> $\1
|
||||
if (!isalpha(*src) && *src != '_' && *src != '-' && *src != '*') {
|
||||
dst += '$';
|
||||
dst += *src++;
|
||||
return;
|
||||
|
@ -793,10 +793,15 @@ process_event(char *buffer)
|
|||
devdlog(LOG_INFO, "Processing event '%s'\n", buffer);
|
||||
type = *buffer++;
|
||||
cfg.push_var_table();
|
||||
// $* is the entire line
|
||||
cfg.set_variable("*", buffer - 1);
|
||||
// $_ is the entire line without the initial character
|
||||
cfg.set_variable("_", buffer - 1);
|
||||
// No match doesn't have a device, and the format is a little
|
||||
// different, so handle it separately.
|
||||
switch (type) {
|
||||
case notify:
|
||||
//! (k=v)*
|
||||
sp = cfg.set_vars(sp);
|
||||
break;
|
||||
case nomatch:
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
.\" SOFTWARE.
|
||||
.\"
|
||||
.Dd July 11, 2015
|
||||
.Dd March 28, 2016
|
||||
.Dt DEVD.CONF 5
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -234,10 +234,17 @@ A partial list of variables and their possible values that can be used together
|
|||
with the
|
||||
.Ic match
|
||||
statement.
|
||||
The variables are published by the bus based on characteristics of the device
|
||||
that generated the event (for device events).
|
||||
Variables for other classes of events are dependent on those events.
|
||||
.Pp
|
||||
.Bl -tag -width ".Li manufacturer" -compact
|
||||
.It Ic Variable
|
||||
.Ic Description
|
||||
.It Li *
|
||||
The entire message from the current event
|
||||
.It Li _
|
||||
The entire message from the current event, after the initial type character
|
||||
.It Li bus
|
||||
Device name of parent bus.
|
||||
.It Li cdev
|
||||
|
|
Loading…
Reference in a new issue