This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove a trailing space resulting from file name completion


> Date: Thu, 10 May 2007 14:06:32 +0100 (BST)
> From: "Maciej W. Rozycki" <macro@mips.com>
> cc: Chris Dearman <chris@mips.com>, "Maciej W. Rozycki" <macro@linux-mips.org>
> 
>  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  <chris@mips.com>
>             Maciej W. Rozycki  <macro@mips.com>
> 
> 	* 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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]