From 9401cc38ca42459aa389c505ee0085955a99aaec Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 24 Sep 2014 17:43:35 +0100 Subject: [PATCH 2/5] Describe quoting for match rules I wish I could say "I can't believe this was never documented", but it wouldn't be true. --- doc/dbus-specification.xml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index 6c26296..90879bc 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -5415,6 +5415,32 @@ "type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='Foo',path='/bar/foo',destination=':452345.34',arg2='bar'" + Within single quotes (ASCII apostrophe, U+0027), a backslash + (U+005C) represents itself, and an apostrophe ends the quoted + section. Outside single quotes, \' (backslash, apostrophe) + represents an apostrophe, and any backslash not followed by + an apostrophe represents itself. For instance, the match rules + arg0=''\''',arg1='\',arg2=',',arg3='\\' and + arg0=\',arg1=\,arg2=',',arg3=\\ + both match messages where the arguments are a 1-character string + containing an apostrophe, a 1-character string containing a + backslash, a 1-character string containing a comma, and a + 2-character string containing two backslashes + + This idiosyncratic quoting style is based on the rules for + escaping items to appear inside single-quoted strings + in POSIX /bin/sh, but please + note that backslashes that are not inside single quotes have + different behaviour. This syntax does not offer any way to + represent an apostrophe inside single quotes (it is necessary + to leave the single-quoted section, backslash-escape the + apostrophe and re-enter single quotes), or to represent a + comma outside single quotes (it is necessary to wrap it in + a single-quoted section). + + . + + The following table describes the keys that can be used to create a match rule. -- 2.1.1