1 #include <dbus/dbus.h>
2
3 #define DBUS_COMPILATION /* cheat and use dbus-sysdeps */
4 #include <dbus/dbus-sysdeps.h>
5 #include <dbus/dbus-spawn.h>
6 #undef DBUS_COMPILATION
7 #include <stdio.h>
8
9 static void
setup_func(void * data)10 setup_func (void *data)
11 {
12 printf ("entering setup func.\n");
13 }
14
15 int
main(int argc,char ** argv)16 main (int argc, char **argv)
17 {
18 char **argv_copy;
19 int i;
20 DBusError error;
21
22 if (argc < 2)
23 {
24 fprintf (stderr, "You need to specify a program to launch.\n");
25
26 return -1;
27 }
28
29 argv_copy = dbus_new (char *, argc);
30 for (i = 0; i < argc - 1; i++)
31 argv_copy [i] = argv[i + 1];
32 argv_copy[argc - 1] = NULL;
33
34 if (!_dbus_spawn_async_with_babysitter (NULL, argv_copy, setup_func, NULL, &error))
35 {
36 fprintf (stderr, "Could not launch application: \"%s\"\n",
37 error.message);
38 }
39
40 return 0;
41 }
42