From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32632 invoked by alias); 14 Apr 2010 22:06:20 -0000 Received: (qmail 32623 invoked by uid 22791); 14 Apr 2010 22:06:19 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SARE_MSGID_LONG45,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Apr 2010 22:06:16 +0000 Received: from kpbe11.cbf.corp.google.com (kpbe11.cbf.corp.google.com [172.25.105.75]) by smtp-out.google.com with ESMTP id o3EM6DKe022211 for ; Wed, 14 Apr 2010 15:06:14 -0700 Received: from pvf33 (pvf33.prod.google.com [10.241.210.97]) by kpbe11.cbf.corp.google.com with ESMTP id o3EM6CYX030551 for ; Wed, 14 Apr 2010 17:06:13 -0500 Received: by pvf33 with SMTP id 33so445893pvf.31 for ; Wed, 14 Apr 2010 15:06:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.247.17 with HTTP; Wed, 14 Apr 2010 15:06:12 -0700 (PDT) In-Reply-To: <201004142152.o3ELqWUG014091@glazunov.sibelius.xs4all.nl> References: <20100414212745.75E5B84396@ruffy.mtv.corp.google.com> <201004142152.o3ELqWUG014091@glazunov.sibelius.xs4all.nl> Date: Wed, 14 Apr 2010 22:06:00 -0000 Received: by 10.141.125.5 with SMTP id c5mr1382636rvn.254.1271282772586; Wed, 14 Apr 2010 15:06:12 -0700 (PDT) Message-ID: Subject: Re: [commit] Strip DOS drive letter in openp From: Doug Evans To: Mark Kettenis Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true 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: 2010-04/txt/msg00459.txt.bz2 On Wed, Apr 14, 2010 at 2:52 PM, Mark Kettenis wr= ote: >> Date: Wed, 14 Apr 2010 14:27:45 -0700 (PDT) >> From: dje@google.com (Doug Evans) >> >> Hi. >> >> I've checked in this patch which strips a DOS drive spec if present >> before concatenating string with the search path. >> >> This is in reference to this thread: >> http://sourceware.org/ml/gdb-patches/2010-04/msg00110.html >> and in particular: >> http://sourceware.org/ml/gdb-patches/2010-04/msg00277.html >> >> 2010-04-14 =A0Doug Evans =A0 >> >> =A0 =A0 =A0 * source.c (openp): Strip DOS drive letter if present before >> =A0 =A0 =A0 concatenating string to search path. >> >> Index: source.c >> =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 >> RCS file: /cvs/src/src/gdb/source.c,v >> retrieving revision 1.109 >> diff -u -p -r1.109 source.c >> --- source.c =A08 Apr 2010 21:08:39 -0000 =A0 =A0 =A0 1.109 >> +++ source.c =A014 Apr 2010 21:18:59 -0000 >> @@ -724,6 +724,10 @@ openp (const char *path, int opts, const >> =A0 =A0 =A0 =A0 =A0 goto done; >> =A0 =A0 =A0} >> >> + =A0/* For dos paths, d:/foo -> /foo, and d:foo -> foo. =A0*/ >> + =A0if (HAS_DRIVE_SPEC (string)) >> + =A0 =A0string =3D STRIP_DRIVE_SPEC (string); >> + > > Eh, where does HAS_DRIVE_SPEC come from? > It's new, in {gcc,src}/include/filenames.h. Already approved and checked i= n. Sorry for not including it, and noting that you need to update src/include. HEADS UP EVERYONE: You need to update src/include. 2010-04-14 Doug Evans * filenames.h (HAS_DRIVE_SPEC, STRIP_DRIVE_SPEC): New macros. Index: filenames.h =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 RCS file: /cvs/src/src/include/filenames.h,v retrieving revision 1.5 diff -u -p -r1.5 filenames.h --- filenames.h 21 Mar 2008 23:40:18 -0000 1.5 +++ filenames.h 12 Apr 2010 17:19:32 -0000 @@ -5,7 +5,7 @@ use forward- and back-slash in path names interchangeably, and some of them have case-insensitive file names. - Copyright 2000, 2001, 2007 Free Software Foundation, Inc. + Copyright 2000, 2001, 2007, 2010 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -37,17 +37,27 @@ extern "C" { #endif #define IS_DIR_SEPARATOR(c) ((c) =3D=3D '/' || (c) =3D=3D '\\') + +#define HAS_DRIVE_SPEC(f) (((f)[0]) && ((f)[1] =3D=3D ':')) + +/* Remove the drive spec from F, assuming HAS_DRIVE_SPEC (f). + The result is a pointer to the remainder of F. */ +#define STRIP_DRIVE_SPEC(f) ((f) + 2) + /* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is only semi-absolute. This is because the users of IS_ABSOLUTE_PATH want to know whether to prepend the current working directory to a file name, which should not be done with a name like d:foo. */ -#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] =3D=3D ':'))) +#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || HAS_DRIVE_SPEC(f)) #else /* not DOSish */ #define IS_DIR_SEPARATOR(c) ((c) =3D=3D '/') #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) +#define HAS_DRIVE_SPEC(f) (0) +#define STRIP_DRIVE_SPEC(f) (f) + #endif /* not DOSish */ extern int filename_cmp (const char *s1, const char *s2);