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