Merge pull request #719 from jg1uaa/master

This commit is contained in:
Jonathan Naylor 2021-10-25 16:19:15 +01:00 committed by GitHub
commit 8a5f79878e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -435,7 +435,7 @@ bool CConf::read()
continue;
}
char* key = ::strtok(buffer, " \t=\r\n");
char* key = ::strtok(buffer, " \t=\r\n");
if (key == NULL)
continue;
@ -449,8 +449,15 @@ bool CConf::read()
value[len - 1U] = '\0';
value++;
} else {
char *p;
// if value is not quoted, remove after # (to make comment)
(void)::strtok(value, "#");
if ((p = strchr(value, '#')) != NULL)
*p = '\0';
// remove trailing tab/space
for (p = value + strlen(value) - 1U; p >= value && (*p == '\t' || *p == ' '); p--)
*p = '\0';
}
if (section == SECTION_GENERAL) {