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