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