[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conflicts between pathname.h and dirname.h
From: |
Ben Pfaff |
Subject: |
Re: conflicts between pathname.h and dirname.h |
Date: |
Sat, 24 Feb 2007 22:28:56 -0800 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux) |
Paul Eggert <address@hidden> writes:
> Ben Pfaff <address@hidden> writes:
>
>> pathname.h and dirname.h define macros with the same names, but
>> conflicting definitions. Should they be merged?
>
> Well, if you want my biased opinion, pathname should go. :-)
>
> The GNU Coding Standards say that one shouldn't use the word
> "pathname" to describe file names.
>
> This issue is controversial, though -- as I recall, Bruno doesn't
> think internals like gnulib need to follow those standards.
Here is my attempt at a minimally invasive resolution of the
differences, which should be good enough to let both headers be
included at once. No code in gnulib/lib uses IS_ABSOLUTE_PATH or
IS_PATH_WITH_DIR from pathname.h, so it shouldn't affect anything
in gnulib.
I guess we'll see what Bruno thinks...
Index: lib/pathname.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/pathname.h,v
retrieving revision 1.5
diff -u -p -r1.5 pathname.h
--- lib/pathname.h 14 May 2005 06:03:58 -0000 1.5
+++ lib/pathname.h 25 Feb 2007 06:24:29 -0000
@@ -1,5 +1,5 @@
/* Pathname support.
- Copyright (C) 2001-2004 Free Software Foundation, Inc.
+ Copyright (C) 2001-2004, 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,35 +18,12 @@
#ifndef _PATHNAME_H
#define _PATHNAME_H
+#include "dirname.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-
-/* Pathname support.
- ISSLASH(C) tests whether C is a directory separator character.
- IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
- it may be concatenated to a directory pathname.
- IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
- */
-#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined
__EMX__ || defined __DJGPP__
- /* Win32, Cygwin, OS/2, DOS */
-# define ISSLASH(C) ((C) == '/' || (C) == '\\')
-# define HAS_DEVICE(P) \
- ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
- && (P)[1] == ':')
-# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
-# define IS_PATH_WITH_DIR(P) \
- (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
-# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
-#else
- /* Unix */
-# define ISSLASH(C) ((C) == '/')
-# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
-# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
-# define FILE_SYSTEM_PREFIX_LEN(P) 0
-#endif
-
/* Concatenate a directory pathname, a relative pathname and an optional
suffix. Return a freshly allocated pathname. */
extern char *concatenated_pathname (const char *directory,
Index: modules/pathname
===================================================================
RCS file: /cvsroot/gnulib/gnulib/modules/pathname,v
retrieving revision 1.2
diff -u -p -r1.2 pathname
--- modules/pathname 22 Sep 2004 15:11:04 -0000 1.2
+++ modules/pathname 25 Feb 2007 06:24:30 -0000
@@ -9,6 +9,7 @@ lib/concatpath.c
Depends-on:
xalloc
stpcpy
+dirname
configure.ac:
--
"J'avais trouv'e ma religion :
rien ne me parut plus important qu'un livre.
La biblioth`eque, j'y voyais un temple."
--Jean-Paul Sartre