From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24162 invoked by alias); 11 May 2007 08:12:53 -0000 Received: (qmail 24154 invoked by uid 22791); 11 May 2007 08:12:53 -0000 X-Spam-Check-By: sourceware.org Received: from heller.inter.net.il (HELO heller.inter.net.il) (213.8.233.23) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 11 May 2007 08:12:51 +0000 Received: from HOME-C4E4A596F7 (IGLD-84-228-164-100.inter.net.il [84.228.164.100]) by heller.inter.net.il (MOS 3.7.3a-GA) with ESMTP id COF43131 (AUTH halo1); Fri, 11 May 2007 11:11:11 +0300 (IDT) Date: Fri, 11 May 2007 08:12:00 -0000 Message-Id: From: Eli Zaretskii To: "Maciej W. Rozycki" CC: gdb-patches@sourceware.org, chris@mips.com, macro@linux-mips.org In-reply-to: (macro@mips.com) Subject: Re: Remove a trailing space resulting from file name completion Reply-to: Eli Zaretskii References: X-IsSubscribed: yes 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 X-SW-Source: 2007-05/txt/msg00184.txt.bz2 > Date: Thu, 10 May 2007 14:06:32 +0100 (BST) > From: "Maciej W. Rozycki" > cc: Chris Dearman , "Maciej W. Rozycki" > > As a file with a trailing space is indeed not desired in about any case, > I propose the following change to be included. > > 2007-05-10 Chris Dearman > Maciej W. Rozycki > > * cli/cli-setshow.c (do_setshow_command): Remove trailing > whitespace when setting a var_filename. This is okay, but suppose I _did_ want a file name with trailing space: how would I go about that in this situation? Is there a way? If there isn't, either we should introduce one, or else we should tell in the command's doc string and in the manual that this is a restriction. > +++ gdb/src/gdb/cli/cli-setshow.c 2007-02-13 13:51:29.000000000 +0000 > @@ -192,6 +192,13 @@ > error_no_arg (_("filename to set it to.")); > if (*(char **) c->var != NULL) > xfree (*(char **) c->var); > + { > + /* Clear trailing whitespace of filename. */ > + char *ptr = arg + strlen (arg) - 1; > + while (ptr >= arg && (*ptr == ' ' || *ptr == '\t')) > + ptr--; > + *(ptr + 1) = '\0'; > + } Shouldn't you again check whether anything was left after stripping whitespace, and if not, output the same ``no filename to set it to" error message?