From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11584 invoked by alias); 4 Jan 2008 19:26:22 -0000 Received: (qmail 11574 invoked by uid 22791); 4 Jan 2008 19:26:22 -0000 X-Spam-Check-By: sourceware.org Received: from qnxmail.qnx.com (HELO nimbus.ott.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 04 Jan 2008 19:25:52 +0000 Received: by nimbus.ott.qnx.com with Internet Mail Service (5.5.2653.19) id ; Fri, 4 Jan 2008 14:25:48 -0500 Message-ID: <2F6320727174C448A52CEB63D85D11F40A4C@nova.ott.qnx.com> From: Aleksandar Ristovski To: Aleksandar Ristovski , gdb-patches@sourceware.org Cc: Daniel Jacobowitz , Joel Brobecker , Ryan Mansfield Subject: RE: [patch] IS_ABSOLUTE_PATH to handle both DOS and POSIX path st yles Date: Fri, 04 Jan 2008 19:26:00 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain 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: 2008-01/txt/msg00062.txt.bz2 Oops... the patch I submitted has a few typos. Sorry about that. Here is the correct one. This patch introduces new IS_DIR_SEPARATOR_? And IS_ABSOLUTE_PATH_? Macros. Old macros IS_DIR_SEPARATOR and IS_ABSOLUTE_PATH continue to be configured host dependent. Please see http://sourceware.org/ml/gdb/2008-01/msg00021.html for details on why this patch. --- Aleksandar Ristovski QNX Software Systems ChangeLog: 2008-01-04 Aleksandar Ristovski * filenames.h (IS_DIR_SEPARATOR_DOS): New macro. (IS_ABSOLUTE_PATH_DOS): New macro. (IS_DIR_SEPARATOR_X): New macro. (IS_ABSOLUTE_PATH_X): New macro. (IS_DIR_SEPARATOR_ANY): New macro. (IS_ABSOLUTE_PATH_ANY): New macro. Index: include/filenames.h =================================================================== RCS file: /cvs/src/src/include/filenames.h,v retrieving revision 1.4 diff -u -3 -p -r1.4 filenames.h --- include/filenames.h 29 Mar 2007 21:03:43 -0000 1.4 +++ include/filenames.h 4 Jan 2008 19:22:02 -0000 @@ -26,6 +26,23 @@ Foundation, Inc., 51 Franklin Street - F #ifndef FILENAMES_H #define FILENAMES_H +/* For DOS style paths. Note that these macros do not recognize + path starting with '/' as an absolute path. */ + +#define IS_DIR_SEPARATOR_DOS(c) ((c) == '/' || (c) == '\\') +#define IS_ABSOLUTE_PATH_DOS(f) (((f)[0]) && ((f)[1] == ':')) + +/* For POSIX style paths. */ + +#define IS_DIR_SEPARATOR_X(c) ((c) == '/') +#define IS_ABSOLUTE_PATH_X(f) (IS_DIR_SEPARATOR_X((f)[0])) + +/* Universal macros, to be used on paths that could be either + POSIX or DOS. */ + +#define IS_DIR_SEPARATOR_ANY(c) (IS_DIR_SEPARATOR_DOS(c)) +#define IS_ABSOLUTE_PATH_ANY(f) (IS_ABSOLUTE_PATH_X(f) || IS_ABSOLUTE_PATH_DOS(f)) + #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) #ifndef HAVE_DOS_BASED_FILE_SYSTEM