]> git.saurik.com Git - apple/launchd.git/blob - launchd/testing/vproc_swap_complex.c
launchd-392.39.tar.gz
[apple/launchd.git] / launchd / testing / vproc_swap_complex.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <stdbool.h>
4 #include <unistd.h>
5 #include <assert.h>
6 #include <vproc.h>
7 #include <vproc_priv.h>
8
9 static void my_callback(const launch_data_t obj, const char *key, void *context);
10
11 int main(void)
12 {
13 launch_data_t output_obj = NULL;
14
15 assert(vproc_swap_complex(NULL, VPROC_GSK_ENVIRONMENT, NULL, &output_obj) == 0);
16
17 assert(launch_data_get_type(output_obj) == LAUNCH_DATA_DICTIONARY);
18
19 launch_data_dict_iterate(output_obj, my_callback, stdout);
20
21 return 0;
22 }
23
24 void
25 my_callback(const launch_data_t obj, const char *key, void *context)
26 {
27 fprintf(context, "%s == %s\n", key, launch_data_get_string(obj));
28 }