mako
mako copied to clipboard
config: ignore leading and trailing whitespace
Leading and trailing whitespace is now stripped before parsing the line.
getline returns line length, so strlen calls have been replaced with that. Also, getline now runs until -1 is returned.
Additionally, the entire line (whitespace stripped) is now printed to stderr when mako fails to parse an option.
Closes #107 and #282
Oops, there is a bug in this. If there is no newline after the last line, the last character is not read (since len is decremented by 1). I'm rebasing and force-pushing the fix.
I thought I would implement the "strip leading whitespace" in another commit, but it was small, so added here.
PS: Sorry for the noise
Yeah, guess C is hard if stripping whitespaces from left/right/both ends of the string requires copying of the whole string and all the efforts.
In the meantime, users are stuck with the config that is easier to parse for machines rather than for them to read. =
(=
wrapped with whitespaces) is used for assignments in all the C sources :disappointed_relieved:
/* rant off, sorry */