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