On Thursday, June 29 2017, Simon Marchi wrote:
On 2017-06-29 21:48, Sergio Durigan Junior wrote:
On Thursday, June 29 2017, Simon Marchi wrote:
Another (maybe simpler) way would be to check
else if (command_name_equals (cmd, "python") && *cmd_name == '\0')
It's not clear when expressed like this though because cmd_name is
not
well named at this point (it points just after the command name).
Hm, right. Would you prefer this way instead? I don't have a strong
opinion on this.
My opinion is the solution with the least code is probably best, if
they are equivalent otherwise, but I don't really mind. It's just a
suggestion.
Right. I did some more tests here, and unfortunately your solution
doesn't work for all cases. For example, if the user puts trailing
whitespace on the command name (like "python "), *cmd_name will point
to
a whitespace after the call to lookup_cmd_1.