*/
static int findKey(KFile *fd, const char *key, char *line, size_t size)
{
- while (kfile_gets(fd, line, size) != EOF && *line != '[')
+ int err;
+ do
{
+ err = kfile_gets(fd, line, size);
char curr_key[30];
getKey(line, curr_key, 30);
/* check key */
if (!strcmp(curr_key, key))
return 0;
}
+ while (err != EOF && *line != '[');
return EOF;
}
ASSERT(ini_getString(&kf.fd, "Long section with spaces", "value", "", buf, 30) != EOF);
ASSERT(strcmp(buf, "long value") == 0);
+
+ ASSERT(ini_getString(&kf.fd, "Long section with spaces", "no_new_line", "", buf, 30) != EOF);
+ ASSERT(strcmp(buf, "value") == 0);
return 0;
}