| 430 | } |
| 431 | |
| 432 | static void ParseEntry(Context* context, char* value_buf, int value_len) |
| 433 | { |
| 434 | char key_buf[CATEGORY_MAX_SIZE + 512]; |
| 435 | int category_len = strlen(context->m_CategoryBuffer); |
| 436 | memcpy(key_buf, context->m_CategoryBuffer, category_len); |
| 437 | key_buf[category_len] = '.'; // We have enough space here. |
| 438 | category_len++; |
| 439 | |
| 440 | key_buf[category_len] = '\0'; // TODO: TMP REMOVE ME |
| 441 | |
| 442 | ParseKey(context, key_buf + category_len, sizeof(key_buf) - category_len); |
| 443 | EatBlank(context); |
| 444 | Expect(context, '='); |
| 445 | EatBlank(context); |
| 446 | |
| 447 | ParseLiteral(context, value_buf, value_len); |
| 448 | |
| 449 | for (int i = 0; i < context->m_Argc; ++i) |
| 450 | { |
| 451 | const char* arg = context->m_Argv[i]; |
| 452 | if (strncmp("--config=", arg, sizeof("--config=")-1) == 0) |
| 453 | { |
| 454 | const char* eq = strchr(arg, '='); |
| 455 | const char* eq2 = strchr(eq+1, '='); |
| 456 | if (!eq2) |
| 457 | { |
| 458 | dmLogWarning("Invalid config option: %s", arg); |
| 459 | continue; |
| 460 | } |
| 461 | |
| 462 | if (strncmp(key_buf, eq + 1, eq2 - (eq+1)) == 0) |
| 463 | { |
| 464 | AddEntry(context, key_buf, eq2 + 1); |
| 465 | return; |
| 466 | } |
| 467 | } |
| 468 | } |
| 469 | |
| 470 | AddEntry(context, key_buf, value_buf); |
| 471 | } |
| 472 | |
| 473 | void ParseSection(Context* context) |
| 474 | { |