X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fmware%2Fini_reader.c;h=2f1e3abedd4b6a060ea671ea8a2f5480bfd43c86;hb=1265029d73dae859ad9dc37fb41b908338c7cff8;hp=d16c41a31bb387a72930d18d3a2200c52d591eea;hpb=b46f64914c62fbb0297728280478681659469654;p=bertos.git diff --git a/bertos/mware/ini_reader.c b/bertos/mware/ini_reader.c index d16c41a3..2f1e3abe 100644 --- a/bertos/mware/ini_reader.c +++ b/bertos/mware/ini_reader.c @@ -65,7 +65,11 @@ static int findSection(KFile *fd, const char *section, size_t section_len, char continue; /* did we find the correct section? */ +#if CONFIG_INI_CASE_INSENSITIVE + if(strncasecmp(&line[1], section, section_len)) +#else if(strncmp(&line[1], section, section_len)) +#endif continue; else return 0; @@ -79,10 +83,10 @@ static int findSection(KFile *fd, const char *section, size_t section_len, char static char *getKey(const char *line, char *key, size_t size) { /* null-terminated string */ - while (isspace(*line)) + while (isspace((unsigned char)*line)) ++line; int i = 0; - while (*line != '=' && !isspace(*line) && size) + while (*line != '=' && !isspace((unsigned char)*line) && size) { key[i++] = *line; ++line; @@ -99,7 +103,7 @@ static char *getValue(const char *line, char *value, size_t size) { while (*line++ != '=') ; - while (isspace(*line)) + while (isspace((unsigned char)*line)) ++line; int i = 0; while (*line && size) @@ -127,7 +131,11 @@ static int findKey(KFile *fd, const char *key, char *line, size_t size) char curr_key[30]; getKey(line, curr_key, 30); /* check key */ +#if CONFIG_INI_CASE_INSENSITIVE + if (!strcasecmp(curr_key, key)) +#else if (!strcmp(curr_key, key)) +#endif return 0; } while (err != EOF && *line != '[');