summaryrefslogtreecommitdiffstats
path: root/tools/dbus-monitor.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2003-05-16 16:01:56 +0000
committerColin Walters <walters@verbum.org>2003-05-16 16:01:56 +0000
commit351a91c7365c086942cd9409f9998b01c8b26280 (patch)
treef43997e09ec89487f3dde3c0ee330febea3c095b /tools/dbus-monitor.c
parenta1d3ffb0d417e793ca19a9087000c0dbc3641817 (diff)
2003-05-16 Colin Walters <walters@verbum.org>
* tools/dbus-monitor.c: Add --session argument and usage() function. * tools/dbus-monitor.1: Update with new --session arg. * bus/Makefile.am (install-data-hook): Create $(libdir)/dbus-1.0/services so that the session bus is happy.
Diffstat (limited to 'tools/dbus-monitor.c')
-rw-r--r--tools/dbus-monitor.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/dbus-monitor.c b/tools/dbus-monitor.c
index 8a8e6585..441ead38 100644
--- a/tools/dbus-monitor.c
+++ b/tools/dbus-monitor.c
@@ -89,6 +89,13 @@ handler_func (DBusMessageHandler *handler,
return DBUS_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
}
+static void
+usage (char *name, int ecode)
+{
+ fprintf (stderr, "Usage: %s [--session]\n", name);
+ exit (ecode);
+}
+
int
main (int argc, char *argv[])
{
@@ -97,6 +104,24 @@ main (int argc, char *argv[])
DBusBusType type = DBUS_BUS_SYSTEM;
DBusMessageHandler *handler;
GMainLoop *loop;
+ int i;
+
+ for (i = 1; i < argc; i++)
+ {
+ char *arg = argv[i];
+
+ if (!strcmp (arg, "--session"))
+ type = DBUS_BUS_SESSION;
+ else if (!strcmp (arg, "--help"))
+ usage (argv[0], 0);
+ else if (!strcmp (arg, "--"))
+ break;
+ else if (arg[0] == '-')
+ usage (argv[0], 1);
+ }
+
+ if (argc > 2)
+ usage (argv[0], 1);
loop = g_main_loop_new (NULL, FALSE);