From fc5e3a06cf4876fb10d0205a626e51109f29eb82 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sun, 18 May 2003 02:39:47 +0000 Subject: 2003-05-17 Colin Walters * 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. --- tools/dbus-send.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'tools/dbus-send.c') 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] [contents ...]\n", name); - exit (1); + fprintf (stderr, "Usage: %s [--help] [--session] [--dest=SERVICE] [--print-reply] [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); -- cgit