Broken
[eleutheria.git] / proplib / prop_dict.c
blob5c416241d53c25098a67ed217924776d1c4c6ea6
1 #include <err.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <prop/proplib.h>
6 int main(int argc, char *argv[])
8 prop_dictionary_t pd;
9 prop_string_t ps;
10 unsigned int i;
12 /* Create a dictionary capable of holding `argc - 1' objects */
13 pd = prop_dictionary_create_with_capacity(argc - 1);
14 if (pd == NULL)
15 errx(EXIT_FAILURE, "prop_dictionary_create_with_capacity");
18 * For every supplied argument, create a <key, symbol> pair
19 * and store it inside the dictionary
21 for (i = 1; i < argc; i++) {
22 ps = prop_string_create_cstring_nocopy(argv[i]);
23 prop_dictionary_set(pd, argv[i], ps);
24 prop_object_release(ps);
27 /* Output our property list as an XML file */
28 if (prop_dictionary_externalize_to_file(pd, "./data.xml") == FALSE) {
29 prop_object_release(pd);
30 errx(EXIT_FAILURE, "prop_dictionary_externalize_to_file");
33 prop_object_release(pd);
35 return EXIT_SUCCESS;