3 * gcc prop_dict.c -o prop_dict -lprop -Wall -W -Wextra -ansi -pedantic
9 #include <prop/proplib.h>
11 int main(int argc
, char *argv
[])
17 /* Create a dictionary capable of holding `argc - 1' objects */
18 pd
= prop_dictionary_create_with_capacity(argc
- 1);
20 errx(EXIT_FAILURE
, "prop_dictionary_create_with_capacity");
23 * For every supplied argument, create a <key, symbol> pair
24 * and store it inside the dictionary
26 for (i
= 1; i
< argc
; i
++) {
27 ps
= prop_string_create_cstring_nocopy(argv
[i
]);
28 prop_dictionary_set(pd
, argv
[i
], ps
);
29 prop_object_release(ps
);
32 /* Output our property list as an XML file */
33 if (prop_dictionary_externalize_to_file(pd
, "./data.xml") == FALSE
) {
34 prop_object_release(pd
);
35 errx(EXIT_FAILURE
, "prop_dictionary_externalize_to_file");
38 prop_object_release(pd
);