6 static int handler(void* user
, const char* section
, const char* name
, const char* value
)
8 configuration
* pconfig
= (configuration
*)user
;
10 #define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0
11 if (MATCH("global", "credit_value")) {
12 pconfig
->credit_value
= atoi(value
);
13 //}else if (MATCH("user", "name")) {
14 // pconfig->name = strdup(value);
15 //} else if (MATCH("user", "email")) {
16 // pconfig->email = strdup(value);
18 return 0; /* unknown section/name, error */
23 int init_config(configuration
*config
)
25 return ini_parse("config.ini", handler
, config
) >= 0;