diff -ruN dbus-0.23,orig/tools/dbus-monitor.1 dbus-0.23/tools/dbus-monitor.1 --- dbus-0.23,orig/tools/dbus-monitor.1 2003-06-21 18:20:30.000000000 -0400 +++ dbus-0.23/tools/dbus-monitor.1 2005-01-31 14:39:12.844787813 -0500 @@ -8,7 +8,7 @@ .SH SYNOPSIS .PP .B dbus-monitor -[\-\-system | \-\-session] +[\-\-system | \-\-session | \-\-address ADDRESS] .SH DESCRIPTION @@ -36,6 +36,9 @@ .TP .I "--session" Monitor the session message bus. (This is the default.) +.TP +.I "--address ADDRESS" +Monitor an arbitrary message bus given at ADDRESS. .SH AUTHOR dbus-monitor was written by Philip Blundell. diff -ruN dbus-0.23,orig/tools/dbus-monitor.c dbus-0.23/tools/dbus-monitor.c --- dbus-0.23,orig/tools/dbus-monitor.c 2004-10-29 14:52:30.000000000 -0400 +++ dbus-0.23/tools/dbus-monitor.c 2005-01-31 14:37:14.002615297 -0500 @@ -49,7 +49,7 @@ static void usage (char *name, int ecode) { - fprintf (stderr, "Usage: %s [--system | --session]\n", name); + fprintf (stderr, "Usage: %s [--system | --session | --address ADDRESS]\n", name); exit (ecode); } @@ -59,6 +59,7 @@ DBusConnection *connection; DBusError error; DBusBusType type = DBUS_BUS_SESSION; + char *address = NULL; GMainLoop *loop; int i; @@ -70,6 +71,16 @@ type = DBUS_BUS_SYSTEM; else if (!strcmp (arg, "--session")) type = DBUS_BUS_SESSION; + else if (!strcmp (arg, "--address")) + { + if (i+1 < argc) + { + address = argv[i+1]; + i++; + } + else + usage (argv[0], 1); + } else if (!strcmp (arg, "--help")) usage (argv[0], 0); else if (!strcmp (arg, "--")) @@ -78,20 +89,39 @@ usage (argv[0], 1); } - if (argc > 2) - usage (argv[0], 1); - loop = g_main_loop_new (NULL, FALSE); dbus_error_init (&error); - connection = dbus_bus_get (type, &error); - if (connection == NULL) + + if (address == NULL) + { + connection = dbus_bus_get (type, &error); + if (connection == NULL) + { + fprintf (stderr, "Failed to open connection to %s message bus: %s\n", + (type == DBUS_BUS_SYSTEM) ? "system" : "session", + error.message); + dbus_error_free (&error); + exit (1); + } + } + else { - fprintf (stderr, "Failed to open connection to %s message bus: %s\n", - (type == DBUS_BUS_SYSTEM) ? "system" : "session", - error.message); - dbus_error_free (&error); - exit (1); + connection = dbus_connection_open (address, &error); + if (connection == NULL) + { + fprintf (stderr, "Failed to open connection to bus at %s: %s\n", + address, error.message); + dbus_error_free (&error); + exit (1); + } + if (!dbus_bus_register (connection, &error)) + { + fprintf (stderr, "Failed to register connection to bus at %s: %s\n", + address, error.message); + dbus_error_free (&error); + exit (1); + } } dbus_connection_setup_with_g_main (connection, NULL);