2003-05-16 Colin Walters <walters@verbum.org>
authorColin Walters <walters@verbum.org>
Fri, 16 May 2003 16:01:56 +0000 (16:01 +0000)
committerColin Walters <walters@verbum.org>
Fri, 16 May 2003 16:01:56 +0000 (16:01 +0000)
* 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.

ChangeLog
bus/Makefile.am
tools/dbus-monitor.1
tools/dbus-monitor.c

index 2f3326d..1d60b5a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+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.
+
 2003-05-15  Havoc Pennington  <hp@redhat.com>
 
        * dbus/dbus-sysdeps.c (_dbus_atomic_dec, _dbus_atomic_inc): work
index 8c316f3..2773507 100644 (file)
@@ -86,6 +86,7 @@ clean-local:
 install-data-hook:
        $(mkinstalldirs) $(DESTDIR)/$(localstatedir)/run/dbus
        $(mkinstalldirs) $(DESTDIR)/$(configdir)/system.d
+       $(mkinstalldirs) $(DESTDIR)/$(libdir)/dbus-1.0/services
 
 #### Init scripts fun
 SCRIPT_IN_FILES=messagebus.in
index 2c72873..ff4172e 100644 (file)
@@ -8,6 +8,7 @@ dbus-monitor \- debug probe to print message bus messages
 .SH SYNOPSIS
 .PP
 .B dbus-monitor
+[\-\-session]
 
 .SH DESCRIPTION
 
@@ -20,9 +21,8 @@ the big picture.
 There are two well-known message buses: the systemwide message bus
 (installed on many systems as the "messagebus" service) and the
 per-user-login-session message bus (started each time a user logs in).
-Right now, \fIdbus-monitor\fP is hardcoded to only work with the
-systemwide message bus. It should really be extended to have a
-\-\-session command line option as with \fIdbus-send\fP.
+\fIdbus-monitor\fP by default monitors the systemwide bus; to monitor the
+session bus, specify \-\-session.
 
 .PP 
 The message bus configuration may keep \fIdbus-monitor\fP from seeing
index 8a8e658..441ead3 100644 (file)
@@ -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);