| 12 | } configuration; |
| 13 | |
| 14 | static 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 | |
| 30 | int main(int argc, char* argv[]) { |
| 31 | configuration config; |
nothing calls this directly
no outgoing calls
no test coverage detected