[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] dos.m4 revisited
From: |
Derek Robert Price |
Subject: |
Re: [Bug-gnulib] dos.m4 revisited |
Date: |
Wed, 12 May 2004 10:41:18 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jim Meyering wrote:
>Derek Robert Price <address@hidden> wrote:
>
>>Paul Eggert wrote:
>>
>>>Derek Robert Price <address@hidden> writes:
>>>
>>>>both `/' and `\' are called "slashes" on most systems. I would like
>>>>to suggest that the `ISSLASH' macro be renamed `ISDIRSEP' or the like.
>>>
>>>
>>>There's prececedent for that. emacs uses IS_DIRECTORY_SEP. GCC uses
>>>IS_DIR_SEPARATOR. On the other hand, several programs use ISSLASH as
>>>well....
>>
>>I just think ISDIRSEP would be clearer since a "slash" can have
>>meanings other than a path element separator in other contexts, though
>>I will grant there is probably rarely ambiguity in projects using
GNULIB,
>>
>>Regardless, it would increase readability for people not familar with
>>the code, so I will generate a patch if there is a consensus.
>
>
>It'd be good to standardize the names and use of such macros.
>Just yesterday I wrote code to test whether a file name
>represents an absolute path name. It would have been nice
>to have a ready-made, portable macro.
I agree. Don't know where its final resting place should be, but
there is already a definition in pathname.h:
address@hidden gnulib]$ grep IS_\\?ABSOLUTE lib/*.[ch] m4/*.m4
lib/pathname.h: IS_ABSOLUTE_PATH(P) tests whether P is an absolute
path. If
it is not,
lib/pathname.h:# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) ||
HAS_DEVICE (P))lib/pathname.h:# define IS_ABSOLUTE_PATH(P) ISSLASH
((P)[0])
address@hidden gnulib]$
Of course, pathname.h has a conflicting definition for ISSLASH, as do
several other GNULIB modules:
address@hidden gnulib]$ grep "define IS_\\?SLASH" lib/*.[ch] m4/*.m4
lib/dirname.h:# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
lib/localcharset.c:# define ISSLASH(C) ((C) == '/' || (C) == '\\')
lib/localcharset.c:# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
lib/pathname.h:# define ISSLASH(C) ((C) == '/' || (C) == '\\')
lib/pathname.h:# define ISSLASH(C) ((C) == '/')
lib/progreloc.c:# define ISSLASH(C) ((C) == '/' || (C) == '\\')
lib/progreloc.c:# define ISSLASH(C) ((C) == '/')
m4/dos.m4:# define ISSLASH(C) ((C) == '/' || (C) == '\\')
m4/dos.m4:# define ISSLASH(C) ((C) == '/')
address@hidden gnulib]$
>I have a slight preference for IS_DIR_SEPARATOR.
I don't really have a preference, as long as it is in the IS +
DIRECTORY + SEPARATOR vein, so this would be fine by me.
Cheers,
Derek
- --
*8^)
Email: address@hidden
Get CVS support at <http://ximbiot.com>!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFAojeNLD1OTBfyMaQRAo/IAJ90NN4C6f8OSmHGXdsKWBmoGvPgKwCg6EmT
PJxer9gdLcB3OqwxKKUalo8=
=NFIP
-----END PGP SIGNATURE-----