diff options
author | Anders Carlsson <andersca@codefactory.se> | 2003-02-15 17:18:13 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@codefactory.se> | 2003-02-15 17:18:13 +0000 |
commit | 2aa38be20b015777ec6570d1e2fd7e072f5f3be9 (patch) | |
tree | e08632fff63b7edc17c47af46fb6c54a55e8960a /test/spawn-test.c | |
parent | 0c502d5bc3c1858acb78d57439767f8ef24f90fe (diff) |
2003-02-15 Anders Carlsson <andersca@codefactory.se>
* dbus/dbus-errors.c: (dbus_set_error):
* dbus/dbus-errors.h:
Add a few errors and make dbus_set_error void.
* dbus/dbus-sysdeps.c:
(_dbus_errno_to_string), (close_and_invalidate), (make_pipe),
(write_err_and_exit), (read_ints), (do_exec), (_dbus_spawn_async):
* dbus/dbus-sysdeps.h:
Add _dbus_spawn_async.
* test/spawn-test.c: (main):
Test for _dbus_spawn_async.
Diffstat (limited to 'test/spawn-test.c')
-rw-r--r-- | test/spawn-test.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/spawn-test.c b/test/spawn-test.c new file mode 100644 index 00000000..fda0309b --- /dev/null +++ b/test/spawn-test.c @@ -0,0 +1,34 @@ +#include <dbus/dbus.h> + +#define DBUS_COMPILATION /* cheat and use dbus-sysdeps */ +#include <dbus/dbus-sysdeps.h> +#undef DBUS_COMPILATION +#include <stdio.h> + +int +main (int argc, char **argv) +{ + char **argv_copy; + int i; + DBusError error; + + if (argc < 2) + { + fprintf (stderr, "You need to specify a program to launch.\n"); + + return -1; + } + + argv_copy = dbus_new (char *, argc); + for (i = 0; i < argc - 1; i++) + argv_copy [i] = argv[i + 1]; + argv_copy[argc - 1] = NULL; + + if (!_dbus_spawn_async (argv_copy, &error)) + { + fprintf (stderr, "Could not launch application: \"%s\"\n", + error.message); + } + + return 0; +} |