Daniel Eklöf
e225be1c50
tokenize: free content of argv on failure, and reset the argv pointer
...
This fixes a memory leak when we failed to parse a command line (for
example, because it contained an unclosed quote).
2021-12-25 23:25:30 +01:00
Daniel Eklöf
42ec264075
tokenize: strdup() each individual argv
...
Instead of referencing the un-tokenized “raw” command string, strdup()
each argv. This way, the input string can be ‘const’.
2021-06-20 14:19:22 +02:00
Daniel Eklöf
50bd51c4d4
tokenize: handle escaped quotes
...
We only support escaping quotes inside a quote, and only of the same
type as the enclosing quote.
I.e.
"double quote \"escaped double quote\""
But not
"double quote \'invalid escaped single quote\'"
2020-07-27 16:43:41 +02:00
Daniel Eklöf
a9eeeedc90
tokenize: remove newline from log message (LOG_ERR appends one for us)
2020-07-27 06:04:29 +02:00
Daniel Eklöf
22cd25d360
tokenize: reset *argv = NULL on error
...
This allows the caller to call free() without having to worry about
whether it has already been free:d or not.
Closes #49 .
2020-07-27 06:03:30 +02:00
Daniel Eklöf
2046dc0fbd
slave: break out command line tokenizer
2019-07-17 09:46:45 +02:00