Hello Philippe,
On Thu, 16 Mar 2017 10:19:12 -0400
Philippe Meunier <[email protected]> wrote:
> Ted Unangst wrote:
> >Did I get it backwards? If you have setenv { HERE= there }, your diff
> >changes behavior.
>
> Speaking from the peanut gallery here, but I find this syntax rather
> confusing and error-prone, especially for a security-related file
> such as doas.conf. How about making the list of variables
> comma-separated instead of space-separated, so that the intent is
> clearer from the syntax?
Whilst I agree with this, I presume this would depend on the popular use
case. If Ted and co found the major use case to be just to pass
variables along like this:
setenv { FOO BAR }
then a space-delimited list is fine, and the parser is simpler. As I
see it, this is also acceptable:
setenv { "FOO=" "BAR" }
Adding a comma-separated list will be similar to what I did to move the
'=' processing into the lexer. It's possible, but it does add some code
to the lexer and doesn't allow for much refactoring, unless you also
have command line args like this:
... cmd hello args foo, bar
It also means that command-line arguments with commas in them will need
to be enclosed in quote marks.
I have had a lot of time to think about this. Since equal sign
processing is needed anyway in env.c to process the strings in the
"environ" variable (filled in by the OS), might as well keep it all in
one place.