From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120696 invoked by alias); 30 Jun 2017 07:01:01 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 116331 invoked by uid 89); 30 Jun 2017 07:00:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_SORBS_SPAM,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Jun 2017 07:00:43 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id v5U70a4s014417 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 30 Jun 2017 03:00:41 -0400 Received: by simark.ca (Postfix, from userid 112) id B2D621E8CB; Fri, 30 Jun 2017 03:00:36 -0400 (EDT) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 12CB21E18C; Fri, 30 Jun 2017 03:00:36 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 30 Jun 2017 07:01:00 -0000 From: Simon Marchi To: Sergio Durigan Junior Cc: GDB Patches , Jerome Guitton Subject: Re: [PATCH] PR cli/21688: Fix multi-line/inline command differentiation In-Reply-To: <87fueil9jx.fsf@redhat.com> References: <20170629020527.468-1-sergiodj@redhat.com> <90d0a1563dea6893b5dbcd8df19d0285@polymtl.ca> <87d19mmv7q.fsf@redhat.com> <87fueil9jx.fsf@redhat.com> Message-ID: <725a3a1dc21cf9ad38100468caa83d67@polymtl.ca> X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.0 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Fri, 30 Jun 2017 07:00:36 +0000 X-IsSubscribed: yes X-SW-Source: 2017-06/txt/msg00815.txt.bz2 On 2017-06-30 00:21, Sergio Durigan Junior wrote: > 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. Ah, I got confused because there's some code that strips trailing whitespaces, but it only set p_end, it doesn't modify the string. > So here's second version of the patch, with the fixes you requested > except the one above. WDYT? That LGTM. Simon