From 4097e94af3d2fb1eb865343e3f76ca3949e7c69b Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Sun, 12 Oct 2003 05:59:39 +0000 Subject: 2003-10-12 Havoc Pennington Added test code that 1) starts an actual bus daemon and 2) uses DBusGProxy; fixed bugs that were revealed by the test. Lots more testing possible, but this is the basic framework. * glib/dbus-gproxy.c (dbus_gproxy_manager_unregister): remove empty proxy lists from the proxy list hash * dbus/dbus-message.c (dbus_message_iter_get_args_valist): add a couple of return_if_fail checks * dbus/dbus-pending-call.c (_dbus_pending_call_new): use dbus_new0 to allocate, so everything is cleared to NULL as it should be. * glib/dbus-gmain.c (dbus_connection_setup_with_g_main): pass source as data to dbus_connection_set_timeout_functions() as the timeout functions expected * test/glib/run-test.sh: add a little script to start up a message bus and run tests using it * tools/dbus-launch.1: updates * tools/dbus-launch.c (main): add --config-file option * tools/dbus-launch.c (main): remove confusing else if (runprog) that could never be reached. * dbus/dbus-message.c (dbus_message_new_method_return) (dbus_message_new_error, dbus_message_new_signal): set the no-reply-expected flag on all these. Redundant, but may as well be consistent. --- tools/dbus-launch.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'tools/dbus-launch.c') diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c index 3b429013..dc9dad45 100644 --- a/tools/dbus-launch.c +++ b/tools/dbus-launch.c @@ -593,8 +593,10 @@ main (int argc, char **argv) int bus_pid_to_launcher_pipe[2]; int bus_pid_to_babysitter_pipe[2]; int bus_address_to_launcher_pipe[2]; + char *config_file; exit_with_session = FALSE; + config_file = NULL; prev_arg = NULL; i = 1; @@ -618,8 +620,34 @@ main (int argc, char **argv) version (); else if (strcmp (arg, "--exit-with-session") == 0) exit_with_session = TRUE; - else if (runprog) - usage (1); + else if (strstr (arg, "--config-file=") == arg) + { + const char *file; + + if (config_file != NULL) + { + fprintf (stderr, "--config-file given twice\n"); + exit (1); + } + + file = strchr (arg, '='); + ++file; + + config_file = xstrdup (file); + } + else if (prev_arg && + strcmp (prev_arg, "--config-file") == 0) + { + if (config_file != NULL) + { + fprintf (stderr, "--config-file given twice\n"); + exit (1); + } + + config_file = xstrdup (arg); + } + else if (strcmp (arg, "--config-file") == 0) + ; /* wait for next arg */ else { runprog = arg; @@ -736,9 +764,10 @@ main (int argc, char **argv) execlp ("dbus-daemon-1", "dbus-daemon-1", "--fork", - "--session", "--print-pid", write_pid_fd_as_string, "--print-address", write_address_fd_as_string, + config_file ? "--config-file" : "--session", + config_file, /* has to be last in this varargs list */ NULL); fprintf (stderr, -- cgit