mako icon indicating copy to clipboard operation
mako copied to clipboard

config: ignore leading and trailing whitespace

Open pranjalkole opened this issue 2 years ago • 3 comments

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

pranjalkole avatar Jan 23 '22 12:01 pranjalkole

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.

pranjalkole avatar Jan 23 '22 13:01 pranjalkole

I thought I would implement the "strip leading whitespace" in another commit, but it was small, so added here.

PS: Sorry for the noise

pranjalkole avatar Jan 24 '22 06:01 pranjalkole

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 */

murlakatamenka avatar May 07 '23 18:05 murlakatamenka