summaryrefslogtreecommitdiffstats
path: root/tools/dbus-send.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2003-05-18 02:39:47 +0000
committerColin Walters <walters@verbum.org>2003-05-18 02:39:47 +0000
commitfc5e3a06cf4876fb10d0205a626e51109f29eb82 (patch)
treed769ade2a3a00f707c525aa605e3e85396bfb35a /tools/dbus-send.c
parent8826fea41716e30987511b7739f9cffab7b814c4 (diff)
2003-05-17 Colin Walters <walters@gnu.org>
* tools/dbus-send.c: Don't exit with an error code if --help was passed. Default to using the session bus instead of the system one. * tools/dbus-launch.c: Ditto. * tools/dbus-monitor.c: Ditto. * tools/dbus-send.1: Update with new arguments. * tools/dbus-launch.c: Emit code to export variables. New arguments -s and -c to specify shell syntax, and a bit of code to autodetect syntax. Also, allow specifying a program to run. * tools/dbus-launch.1: Update with new arguments. * tools/dbus-send.1: Ditto. * tools/dbus-monitor.1: Ditto.
Diffstat (limited to 'tools/dbus-send.c')
-rw-r--r--tools/dbus-send.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/dbus-send.c b/tools/dbus-send.c
index ea00a836..cada26a4 100644
--- a/tools/dbus-send.c
+++ b/tools/dbus-send.c
@@ -28,10 +28,10 @@
#include "dbus-print-message.h"
static void
-usage (char *name)
+usage (char *name, int ecode)
{
- fprintf (stderr, "Usage: %s [--session] [--dest=SERVICE] [--print-reply] <message type> [contents ...]\n", name);
- exit (1);
+ fprintf (stderr, "Usage: %s [--help] [--session] [--dest=SERVICE] [--print-reply] <message type> [contents ...]\n", name);
+ exit (ecode);
}
int
@@ -43,12 +43,12 @@ main (int argc, char *argv[])
int print_reply;
DBusMessageIter iter;
int i;
- DBusBusType type = DBUS_BUS_SYSTEM;
+ DBusBusType type = DBUS_BUS_SESSION;
char *dest = DBUS_SERVICE_BROADCAST;
char *name = NULL;
if (argc < 2)
- usage (argv[0]);
+ usage (argv[0], 1);
print_reply = FALSE;
@@ -56,20 +56,22 @@ main (int argc, char *argv[])
{
char *arg = argv[i];
- if (strcmp (arg, "--session") == 0)
- type = DBUS_BUS_SESSION;
+ if (strcmp (arg, "--system") == 0)
+ type = DBUS_BUS_SYSTEM;
else if (strcmp (arg, "--print-reply") == 0)
print_reply = TRUE;
else if (strstr (arg, "--dest=") == arg)
dest = strchr (arg, '=') + 1;
+ else if (!strcmp(arg, "--help"))
+ usage (argv[0], 0);
else if (arg[0] == '-')
- usage (argv[0]);
+ usage (argv[0], 1);
else
name = arg;
}
if (name == NULL)
- usage (argv[0]);
+ usage (argv[0], 1);
dbus_error_init (&error);
connection = dbus_bus_get (type, &error);