Skip to content

Commit

Permalink
permit inline comment
Browse files Browse the repository at this point in the history
  • Loading branch information
jg1uaa committed Oct 25, 2021
1 parent b57b781 commit e6d4bfe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down

0 comments on commit e6d4bfe

Please sign in to comment.