1 diff -urN dbus-0.22.orig/tools/dbus-monitor.1 dbus-0.22/tools/dbus-monitor.1
2 --- dbus-0.22.orig/tools/dbus-monitor.1 2004-10-10 20:47:19.906823680 +1000
3 +++ dbus-0.22/tools/dbus-monitor.1 2004-10-10 20:47:27.791625008 +1000
7 [\-\-system | \-\-session]
13 monitor the system or session buses respectively. If neither is
14 specified, \fIdbus-monitor\fP monitors the session bus.
17 +In order to get \fIdbus-monitor\fP to see the messages you are interested
18 +in, you should specify a set of watch expressions as you would expect to
19 +be passed to the \fIdbus_bus_add_watch\fP function.
22 The message bus configuration may keep \fIdbus-monitor\fP from seeing
23 all messages, especially if you run the monitor as a non-root user.
26 Monitor the session message bus. (This is the default.)
29 +Here is an example of using dbus-monitor to watch for the gnome typing
30 +monitor to say things
33 + dbus-monitor "type='signal',sender='org.gnome.TypingMonitor',interface='org.gnome.TypingMonitor'"
38 dbus-monitor was written by Philip Blundell.
40 --- dbus-0.22-1ubuntu1/tools/dbus-monitor.c 2004-08-10 13:03:37.000000000 +1000
41 +++ dbus-0.22/tools/dbus-monitor.c 2004-10-10 21:38:08.532362152 +1000
44 usage (char *name, int ecode)
46 - fprintf (stderr, "Usage: %s [--system | --session]\n", name);
47 + fprintf (stderr, "Usage: %s [--system | --session] [watch expressions]\n", name);
53 DBusBusType type = DBUS_BUS_SESSION;
57 + int i = 0, j = 0, numFilters = 0;
58 + char **filters = NULL;
59 for (i = 1; i < argc; i++)
63 else if (!strcmp (arg, "--help"))
65 else if (!strcmp (arg, "--"))
68 else if (arg[0] == '-')
72 + filters = (char **)realloc(filters, numFilters * sizeof(char *));
73 + filters[j] = (char *)malloc((strlen(arg) + 1) * sizeof(char *));
74 + snprintf(filters[j], strlen(arg) + 1, "%s", arg);
82 loop = g_main_loop_new (NULL, FALSE);
84 dbus_error_init (&error);
87 dbus_connection_setup_with_g_main (connection, NULL);
89 - dbus_bus_add_match (connection,
92 - if (dbus_error_is_set (&error))
94 - dbus_bus_add_match (connection,
95 - "type='method_call'",
97 - if (dbus_error_is_set (&error))
99 - dbus_bus_add_match (connection,
100 - "type='method_return'",
102 - if (dbus_error_is_set (&error))
104 - dbus_bus_add_match (connection,
107 - if (dbus_error_is_set (&error))
111 + for (i = 0; i < j; i++)
113 + dbus_bus_add_match (connection, filters[i], &error);
114 + if (dbus_error_is_set (&error))
116 + fprintf (stderr, "Failed to setup match \"%s\": %s\n",
117 + filters[i], error.message);
118 + dbus_error_free (&error);
126 + dbus_bus_add_match (connection,
129 + if (dbus_error_is_set (&error))
131 + dbus_bus_add_match (connection,
132 + "type='method_call'",
134 + if (dbus_error_is_set (&error))
136 + dbus_bus_add_match (connection,
137 + "type='method_return'",
139 + if (dbus_error_is_set (&error))
141 + dbus_bus_add_match (connection,
144 + if (dbus_error_is_set (&error))
148 if (!dbus_connection_add_filter (connection, filter_func, NULL, NULL)) {
149 fprintf (stderr, "Couldn't add filter!\n");