summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-08-31 01:51:44 +0000
committerHavoc Pennington <hp@redhat.com>2003-08-31 01:51:44 +0000
commit5fd1e389e1c1c12ad4a55c2af6abdc8e7a2f6d41 (patch)
treeaddef8939d0a23f5aa229f7998b05b3503c2ea15 /tools
parent9a0e83f509bd927b555ff75319f8df66ca61087e (diff)
2003-08-30 Havoc Pennington <hp@pobox.com>
* test/data/valid-config-files/system.d/test.conf: change to root for the user so warnings don't get printed * dbus/dbus-message.c: add dbus_message_get_path, dbus_message_set_path * dbus/dbus-object-tree.c (do_test_dispatch): add test of dispatching to a path * dbus/dbus-string.c (_dbus_string_validate_path): add * dbus/dbus-marshal.c (_dbus_demarshal_object_path): implement (_dbus_marshal_object_path): implement * dbus/dbus-protocol.h (DBUS_HEADER_FIELD_PATH): new header field to contain the path to the target object (DBUS_HEADER_FIELD_SENDER_SERVICE): rename DBUS_HEADER_FIELD_SENDER to explicitly say it's the sender service
Diffstat (limited to 'tools')
-rw-r--r--tools/dbus-send.118
-rw-r--r--tools/dbus-send.c22
2 files changed, 24 insertions, 16 deletions
diff --git a/tools/dbus-send.1 b/tools/dbus-send.1
index 978ee2e7..725507c0 100644
--- a/tools/dbus-send.1
+++ b/tools/dbus-send.1
@@ -8,7 +8,8 @@ dbus-send \- Send a message to a message bus
.SH SYNOPSIS
.PP
.B dbus-send
-[\-\-system | \-\-session] [\-\-dest=SERVICE] [\-\-print-reply] [\-\-type=TYPE] <message name> [contents ...]
+[\-\-system | \-\-session] [\-\-dest=SERVICE] [\-\-print-reply]
+[\-\-type=TYPE] <destination object path> <message name> [contents ...]
.SH DESCRIPTION
@@ -28,21 +29,22 @@ specified, \fIdbus-send\fP sends to the session bus.
Nearly all uses of \fIdbus-send\fP must provide the \-\-dest argument
which is the name of a service on the bus to send the message to. If
\-\-dest is omitted, a default service name of
-"org.freedesktop.DBus.Broadcast" is used.
+"org.freedesktop.Broadcast" is used.
.PP
-The name of the message to send must always be specified. Following
-arguments, if any, are the message contents (message arguments).
-These are given as a type name, a colon, and then the value of the
-argument. The possible type names are: string, int32, uint32, double,
-byte, boolean. (D-BUS supports more types than these, but
-\fIdbus-send\fP currently does not.)
+The object path and the name of the message to send must always be
+specified. Following arguments, if any, are the message contents
+(message arguments). These are given as a type name, a colon, and
+then the value of the argument. The possible type names are: string,
+int32, uint32, double, byte, boolean. (D-BUS supports more types than
+these, but \fIdbus-send\fP currently does not.)
.PP
Here is an example invocation:
.nf
dbus-send \-\-dest='org.freedesktop.ExampleService' \\
+ /org/freedesktop/sample/object/name \\
org.freedesktop.ExampleInterface.ExampleMethod \\
int32:47 string:'hello world' double:65.32
diff --git a/tools/dbus-send.c b/tools/dbus-send.c
index 7ea49aac..67abe066 100644
--- a/tools/dbus-send.c
+++ b/tools/dbus-send.c
@@ -30,7 +30,7 @@
static void
usage (char *name, int ecode)
{
- fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--type=TYPE] [--print-reply] <message name> [contents ...]\n", name);
+ fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--type=TYPE] [--print-reply] <destination object path> <message name> [contents ...]\n", name);
exit (ecode);
}
@@ -45,11 +45,12 @@ main (int argc, char *argv[])
int i;
DBusBusType type = DBUS_BUS_SESSION;
const char *dest = DBUS_SERVICE_ORG_FREEDESKTOP_BROADCAST;
- char *name = NULL;
+ const char *name = NULL;
+ const char *path = NULL;
int message_type = DBUS_MESSAGE_TYPE_SIGNAL;
const char *type_str = NULL;
- if (argc < 2)
+ if (argc < 3)
usage (argv[0], 1);
print_reply = FALSE;
@@ -72,8 +73,12 @@ main (int argc, char *argv[])
usage (argv[0], 0);
else if (arg[0] == '-')
usage (argv[0], 1);
+ else if (path == NULL)
+ path = arg;
+ else if (name == NULL)
+ name = arg;
else
- name = arg;
+ usage (argv[0], 1);
}
if (name == NULL)
@@ -117,9 +122,10 @@ main (int argc, char *argv[])
}
*last_dot = '\0';
- message = dbus_message_new_method_call (name,
- last_dot + 1,
- NULL);
+ message = dbus_message_new_method_call (NULL,
+ path,
+ name,
+ last_dot + 1);
}
else if (message_type == DBUS_MESSAGE_TYPE_SIGNAL)
{
@@ -134,7 +140,7 @@ main (int argc, char *argv[])
}
*last_dot = '\0';
- message = dbus_message_new_signal (name, last_dot + 1);
+ message = dbus_message_new_signal (path, name, last_dot + 1);
}
else
{