Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Patch to support spaces in filenames & paths
@ 2008-12-02 13:09 Jon Beniston
  2008-12-02 21:20 ` Michael Snyder
  0 siblings, 1 reply; 10+ messages in thread
From: Jon Beniston @ 2008-12-02 13:09 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]

Hi,

Attached is a patch that adds support for spaces in filenames or paths for
CLI commands such as restore, by supporting quotes. E.g:

restore "path with spaces/test.x" 

2008-12-02 Jon Beniston <jon@beniston.com>

        * cli/cli-dump.c: (scan_filename_with_cleanup) Add support for
quoted 
        strings to allow spaces in paths and filenames.

Cheers,
Jon

[-- Attachment #2: quoted_filenames.patch --]
[-- Type: application/octet-stream, Size: 1555 bytes --]

Index: cli-dump.c
===================================================================
RCS file: /home/CVSROOT/insight/gdb/cli/cli-dump.c,v
retrieving revision 1.1.1.4
diff -c -p -r1.1.1.4 cli-dump.c
*** cli-dump.c	22 Nov 2008 18:47:15 -0000	1.1.1.4
--- cli-dump.c	2 Dec 2008 12:55:36 -0000
*************** scan_filename_with_cleanup (char **cmd, 
*** 98,111 ****
      }
    else
      {
-       /* FIXME: should parse a possibly quoted string.  */
-       char *end;
- 
        (*cmd) = skip_spaces (*cmd);
!       end = *cmd + strcspn (*cmd, " \t");
!       filename = savestring ((*cmd), end - (*cmd));
        make_cleanup (xfree, filename);
-       (*cmd) = skip_spaces (end);
      }
    gdb_assert (filename != NULL);
  
--- 98,125 ----
      }
    else
      {
        (*cmd) = skip_spaces (*cmd);
!       if ((*(*cmd)) == '"')
!         {
!           size_t skip;
!           
!           (*cmd)++;
!           skip = strcspn ((*cmd), "\"");
!           filename = savestring ((*cmd), skip);
!           if (strlen((*cmd)) == skip)
!             error (_("Unterminated string or character constant."));
!           else  
!             (*cmd) = skip_spaces ((*cmd) + skip + 1);  
!         }  
!       else
!         {   
!           char *end;
! 
!           end = *cmd + strcspn (*cmd, " \t");
!           filename = savestring ((*cmd), end - (*cmd));
!           (*cmd) = skip_spaces (end);
!         }  
        make_cleanup (xfree, filename);
      }
    gdb_assert (filename != NULL);
  

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-05 14:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-02 13:09 Patch to support spaces in filenames & paths Jon Beniston
2008-12-02 21:20 ` Michael Snyder
2008-12-02 23:38   ` Daniel Jacobowitz
2008-12-03  0:04     ` Pedro Alves
2008-12-03  0:26     ` Doug Evans
2008-12-04  9:38       ` Denis PILAT
2008-12-04 13:11         ` Daniel Jacobowitz
2008-12-10 15:32           ` Denis PILAT
2008-12-10 16:20             ` Daniel Jacobowitz
2009-01-05 14:20               ` Denis PILAT

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox