Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Jon Beniston" <jon@beniston.com>
To: <gdb-patches@sourceware.org>
Subject: Patch to support spaces in filenames & paths
Date: Tue, 02 Dec 2008 13:09:00 -0000	[thread overview]
Message-ID: <7D653316E38B4305941199D722BF20B0@bibi> (raw)

[-- 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);
  

             reply	other threads:[~2008-12-02 13:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-02 13:09 Jon Beniston [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7D653316E38B4305941199D722BF20B0@bibi \
    --to=jon@beniston.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox