dbus/tools dbus-launch.1,1.3,1.4 dbus-launch.c,1.4,1.5
Havoc Pennington
hp@pdx.freedesktop.org
Sat, 11 Oct 2003 22:59:41 -0700
Update of /cvs/dbus/dbus/tools
In directory pdx:/tmp/cvs-serv535/tools
Modified Files:
dbus-launch.1 dbus-launch.c
Log Message:
2003-10-12 Havoc Pennington <hp@pobox.com>
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.
Index: dbus-launch.1
===================================================================
RCS file: /cvs/dbus/dbus/tools/dbus-launch.1,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-launch.1 18 May 2003 02:39:47 -0000 1.3
+++ dbus-launch.1 12 Oct 2003 05:59:39 -0000 1.4
@@ -7,7 +7,7 @@
dbus-launch \- Utility to start a message bus from a shell script
.SH SYNOPSIS
.PP
-.B dbus-launch [\-\-version] [\-\-sh-syntax] [\-\-csh-syntax] [\-\-auto-syntax] [\-\-exit-with-session] [PROGRAM] [ARGS...]
+.B dbus-launch [\-\-version] [\-\-sh-syntax] [\-\-csh-syntax] [\-\-auto-syntax] [\-\-exit-with-session] [\-\-config-file=FILENAME] [PROGRAM] [ARGS...]
.SH DESCRIPTION
@@ -25,15 +25,18 @@
specified program, with the specified arguments. See below for
examples.
-Finally, you may use the \-\-auto-syntax command to cause
-\fIdbus-launch\fP to emit shell code to set up the environment. This
-is useful in shell scripts. With this option, \fIdbus-launch\fP looks
-at the value of the SHELL environment variable to determine which
-shell syntax should be used. If SHELL ends in "csh", then
-csh-compatible code is emitted; otherwise Bourne shell code is
-emitted. Instead of passing \-\-auto-syntax, you may explicity
-specify a particular one by using \-\-sh-syntax for Bourne syntax, or
-\-\-csh-syntax for csh syntax.
+Finally, you may use the \-\-sh-syntax, \-\-csh-syntax, or
+\-\-auto-syntax commands to cause \fIdbus-launch\fP to emit shell code
+to set up the environment. This is useful in shell scripts.
+
+With the \-\-auto-syntax option, \fIdbus-launch\fP looks at the value
+of the SHELL environment variable to determine which shell syntax
+should be used. If SHELL ends in "csh", then csh-compatible code is
+emitted; otherwise Bourne shell code is emitted. Instead of passing
+\-\-auto-syntax, you may explicity specify a particular one by using
+\-\-sh-syntax for Bourne syntax, or \-\-csh-syntax for csh syntax.
+In scripts, it's more robust to avoid \-\-auto-syntax and you hopefully
+know which shell your script is written in.
.PP
See http://www.freedesktop.org/software/dbus/ for more information
@@ -47,7 +50,7 @@
## test for an existing bus daemon, just to be safe
if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
## if not found, launch a new one
- eval `dbus-launch --auto-syntax --exit-with-session`
+ eval `dbus-launch --sh-syntax --exit-with-session`
echo "D-BUS per-session daemon address is: $DBUS_SESSION_BUS_ADDRESS"
fi
@@ -62,17 +65,22 @@
dbus-launch gnome-session
.fi
-The above would likely be appropriate for ~/.xsession.
+The above would likely be appropriate for ~/.xsession or ~/.Xclients.
.SH OPTIONS
The following options are supported:
.TP
.I "--auto-syntax"
-Attempt to detect the shell in use, and emit compatible code.
+Choose \-\-csh-syntax or \-\-sh-syntax based on the SHELL environment variable.
+
+.TP
+.I "--config-file=FILENAME"
+Pass \-\-config-file=FILENAME to the bus daemon, instead of passing it
+the \-\-session argument. See the man page for dbus-daemon-1
.TP
.I "--csh-syntax"
-Emit csh compatible code.
+Emit csh compatible code to set up environment variables.
.TP
.I "--exit-with-session"
@@ -83,7 +91,7 @@
.TP
.I "--sh-syntax"
-Emit Bourne-shell compatible code.
+Emit Bourne-shell compatible code to set up environment variables.
.TP
.I "--version"
Index: dbus-launch.c
===================================================================
RCS file: /cvs/dbus/dbus/tools/dbus-launch.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dbus-launch.c 17 Jul 2003 01:53:42 -0000 1.4
+++ dbus-launch.c 12 Oct 2003 05:59:39 -0000 1.5
@@ -593,8 +593,10 @@
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 @@
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 @@
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,