MCPcopy Create free account
hub / github.com/Tencent/phxsql / handler

Function handler

phxcomm/configparser/inih-master/examples/ini_example.c:14–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12} configuration;
13
14static int handler(void* user, const char* section, const char* name, const char* value) {
15 configuration* pconfig = (configuration*) user;
16
17#define MATCH(s, n) strcmp(section, s) == 0 && strcmp(name, n) == 0
18 if (MATCH("protocol", "version")) {
19 pconfig->version = atoi(value);
20 } else if (MATCH("user", "name")) {
21 pconfig->name = strdup(value);
22 } else if (MATCH("user", "email")) {
23 pconfig->email = strdup(value);
24 } else {
25 return 0; /* unknown section/name, error */
26 }
27 return 1;
28}
29
30int main(int argc, char* argv[]) {
31 configuration config;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected