1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ofdbus/dbus/tsrc/testapps/dbus_test_cases/spawn-test.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,47 @@
1.4 +/* Portion Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.*/
1.5 +#include <dbus/dbus.h>
1.6 +
1.7 +#define DBUS_COMPILATION /* cheat and use dbus-sysdeps */
1.8 +#ifndef __SYMBIAN32__
1.9 +#include <dbus/dbus-sysdeps.h>
1.10 +#include <dbus/dbus-spawn.h>
1.11 +#else
1.12 +#include "dbus-sysdeps.h"
1.13 +#include "dbus-spawn.h"
1.14 +#endif //__SYMBIAN32__
1.15 +#undef DBUS_COMPILATION
1.16 +#include <stdio.h>
1.17 +
1.18 +static void
1.19 +setup_func (void *data)
1.20 +{
1.21 + printf ("entering setup func.\n");
1.22 +}
1.23 +
1.24 +int
1.25 +main (int argc, char **argv)
1.26 +{
1.27 + char **argv_copy;
1.28 + int i;
1.29 + DBusError error;
1.30 +
1.31 + if (argc < 2)
1.32 + {
1.33 + fprintf (stderr, "You need to specify a program to launch.\n");
1.34 +
1.35 + return -1;
1.36 + }
1.37 +
1.38 + argv_copy = dbus_new (char *, argc);
1.39 + for (i = 0; i < argc - 1; i++)
1.40 + argv_copy [i] = argv[i + 1];
1.41 + argv_copy[argc - 1] = NULL;
1.42 +
1.43 + if (!_dbus_spawn_async_with_babysitter (NULL, argv_copy, setup_func, NULL, &error))
1.44 + {
1.45 + fprintf (stderr, "Could not launch application: \"%s\"\n",
1.46 + error.message);
1.47 + }
1.48 +
1.49 + return 0;
1.50 +}