Ignore trailing whitespace in settings .cfg files

Have settings_parseline() strip trailing whitespace from
the setting value.

Fixes a regression introduced by 5b1dd64f5, which caused
filename settings to be parsed incorrectly when there is
trailing whitespace in the .cfg file.

Change-Id: I6c54428f6467ea2d169d2a7449705b40627e1a40
This commit is contained in:
Aidan MacDonald 2022-12-05 19:25:40 +00:00
parent f3b522cac6
commit 90bc76956c

View file

@ -272,6 +272,15 @@ bool settings_parseline(char* line, char** name, char** value)
ptr++;
ptr = skip_whitespace(ptr);
*value = ptr;
/* strip whitespace from the right side of value */
ptr += strlen(ptr);
for (ptr--; ptr >= *value; ptr--)
{
if (isspace(*ptr))
*ptr = '\0';
}
return true;
}