| 329 | } |
| 330 | |
| 331 | const char* ini_get(ini_t *ini, const char *section, const char *key) { |
| 332 | const char *current_section = ""; |
| 333 | char *val; |
| 334 | char *p = ini->data; |
| 335 | |
| 336 | if (*p == '\0') { |
| 337 | p = next(ini, p); |
| 338 | } |
| 339 | |
| 340 | while (p < ini->end) { |
| 341 | if (*p == '[') { |
| 342 | /* Handle section */ |
| 343 | current_section = p + 1; |
| 344 | |
| 345 | } else { |
| 346 | /* Handle key */ |
| 347 | val = next(ini, p); |
| 348 | if (!section || !strcmpci(section, current_section)) { |
| 349 | if (!strcmpci(p, key)) { |
| 350 | return val; |
| 351 | } |
| 352 | } |
| 353 | p = val; |
| 354 | } |
| 355 | |
| 356 | p = next(ini, p); |
| 357 | } |
| 358 | |
| 359 | return NULL; |
| 360 | } |
| 361 | |
| 362 | int ini_sget( |
| 363 | ini_t *ini, const char *section, const char *value, |