From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20879 invoked by alias); 2 Dec 2008 13:09:01 -0000 Received: (qmail 20865 invoked by uid 22791); 2 Dec 2008 13:09:01 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out5.blueyonder.co.uk (HELO smtp-out5.blueyonder.co.uk) (195.188.213.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Dec 2008 13:08:21 +0000 Received: from [172.23.170.142] (helo=anti-virus02-09) by smtp-out5.blueyonder.co.uk with smtp (Exim 4.52) id 1L7UzC-0003sk-Cl for gdb-patches@sourceware.org; Tue, 02 Dec 2008 13:08:18 +0000 Received: from [77.103.178.228] (helo=bibi) by asmtp-out1.blueyonder.co.uk with esmtp (Exim 4.52) id 1L7UzC-0007tP-0X for gdb-patches@sourceware.org; Tue, 02 Dec 2008 13:08:18 +0000 From: "Jon Beniston" To: Subject: Patch to support spaces in filenames & paths Date: Tue, 02 Dec 2008 13:09:00 -0000 Message-ID: <7D653316E38B4305941199D722BF20B0@bibi> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_002A_01C9547F.0AE2DF30" 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: 2008-12/txt/msg00032.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_002A_01C9547F.0AE2DF30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 366 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 * cli/cli-dump.c: (scan_filename_with_cleanup) Add support for quoted strings to allow spaces in paths and filenames. Cheers, Jon ------=_NextPart_000_002A_01C9547F.0AE2DF30 Content-Type: application/octet-stream; name="quoted_filenames.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="quoted_filenames.patch" Content-length: 1941 Index: cli-dump.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/CVSROOT/insight/gdb/cli/cli-dump.c,v=0A= retrieving revision 1.1.1.4=0A= diff -c -p -r1.1.1.4 cli-dump.c=0A= *** cli-dump.c 22 Nov 2008 18:47:15 -0000 1.1.1.4=0A= --- cli-dump.c 2 Dec 2008 12:55:36 -0000=0A= *************** scan_filename_with_cleanup (char **cmd,=20=0A= *** 98,111 ****=0A= }=0A= else=0A= {=0A= - /* FIXME: should parse a possibly quoted string. */=0A= - char *end;=0A= -=20=0A= (*cmd) =3D skip_spaces (*cmd);=0A= ! end =3D *cmd + strcspn (*cmd, " \t");=0A= ! filename =3D savestring ((*cmd), end - (*cmd));=0A= make_cleanup (xfree, filename);=0A= - (*cmd) =3D skip_spaces (end);=0A= }=0A= gdb_assert (filename !=3D NULL);=0A= =20=20=0A= --- 98,125 ----=0A= }=0A= else=0A= {=0A= (*cmd) =3D skip_spaces (*cmd);=0A= ! if ((*(*cmd)) =3D=3D '"')=0A= ! {=0A= ! size_t skip;=0A= !=20=20=20=20=20=20=20=20=20=20=20=0A= ! (*cmd)++;=0A= ! skip =3D strcspn ((*cmd), "\"");=0A= ! filename =3D savestring ((*cmd), skip);=0A= ! if (strlen((*cmd)) =3D=3D skip)=0A= ! error (_("Unterminated string or character constant."));=0A= ! else=20=20=0A= ! (*cmd) =3D skip_spaces ((*cmd) + skip + 1);=20=20=0A= ! }=20=20=0A= ! else=0A= ! {=20=20=20=0A= ! char *end;=0A= !=20=0A= ! end =3D *cmd + strcspn (*cmd, " \t");=0A= ! filename =3D savestring ((*cmd), end - (*cmd));=0A= ! (*cmd) =3D skip_spaces (end);=0A= ! }=20=20=0A= make_cleanup (xfree, filename);=0A= }=0A= gdb_assert (filename !=3D NULL);=0A= =20=20=0A= ------=_NextPart_000_002A_01C9547F.0AE2DF30--