]> git.ozlabs.org Git - ccan/blob - ccan/ciniparser/_info
hash: use config.h settings for endian.
[ccan] / ccan / ciniparser / _info
1 #include <stdio.h>
2 #include <string.h>
3 #include "config.h"
4
5 /**
6  * ciniparser - easily parse and manipulate ini style configuration files
7  *
8  * A dictionary object is allocated which contains string keys and values.
9  * Functions to read string values return statically allocated objects,
10  * there is no need to free them (also, do not modify them directly).
11  *
12  * Additional functions to manipulate or unset objects in the dictionary
13  * can be found in the test suite.
14  *
15  * Example:
16  *
17  * #include <stdio.h>
18  * #include <stdbool.h>
19  * #include <ccan/ciniparser/ciniparser.h>
20  * 
21  * #define CONFIG_FILE "/etc/config.ini"
22  * 
23  * int main(int argc, char *argv[])
24  * {
25  *              dictionary *d;
26  *              char *val1;
27  *              bool val2;
28  *              double val3;
29  *              int val4;
30  *
31  *              d = ciniparser_load(CONFIG_FILE);
32  *              if (d == NULL)
33  *                      return 1;
34  *
35  *              val1 = ciniparser_getstring(d, "daemon:pidfile", NULL);
36  *              val2 = ciniparser_getboolean(d, "daemon:debug", false);
37  *              val3 = ciniparser_getdouble(d, "daemon:maxload", 3.5);
38  *              val4 = ciniparser_getint(d, "daemon:maxchild", 5);
39  *
40  *              ciniparser_freedict(d);
41  *
42  *              return 0;
43  *}
44  * License: MIT
45  */
46
47 int main(int argc, char *argv[])
48 {
49         if (argc != 2)
50                 return 1;
51
52         if (strcmp(argv[1], "depends") == 0) {
53                 return 0;
54         }
55
56         return 1;
57 }