Re: [PATCH] PR cli/21688: Fix multi-line/inline command differentiation

Sergio Durigan Junior
2017-06-30T12:33:05Z

On Friday, June 30 2017, Pedro Alves wrote:

> On 06/30/2017 12:24 PM, Sergio Durigan Junior wrote:
>
>> Hm, no, it doesn't. I guess that the best approach would be to make
>> sure that lookup_cmd_1 advances the **text pointer past all the
>> whitespace chars after it matches a command, and then we could use
>> Simon's idea and check for *cmd_name != '\0'.
>
> I don't see the point of touching lookup_cmd_1, and then
> handling fallout of that.
>
> Simply do this after the lookup_cmd_1 call:
>
> lookup_cmd = skip_spaces_const (cmd_name);
> bool inline_cmd = *cmd_name != '\0';
>
> and then you can do:
>
> else if (command_name_equals (cmd, "python") && !inline_cmd)
>
> ?

Indeed, that is much easier. I'll send a patch soon.

--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible