bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bugs in dirname module


From: Paul Eggert
Subject: Re: bugs in dirname module
Date: Sun, 06 Nov 2005 02:59:51 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Eric Blake <address@hidden> writes:

> My approach was to add a dependency on the c-ctype module to use c_isalpha

That seems a bit overkill here, since you can assume ASCII and DOS.
Why not use this instead?

#define c_isalpha(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' <= 'z' - 'a')

Or perhaps there's some DOS thingy you can use that does something similar.

> Second, cygwin currently normalizes all drive letters as absolute paths,
> which is different from djgpp

Sigh.  This stuff will probably break a lot of code, not just dirname.
Do we really want to bother with it?  Perhaps we should just tell
users not to mess with names like "c:foo".  I assume they're pretty
rare.  Will that simplify the code here and elsewhere?

> +             {
> +               if (prefix_len)
> +                 base = p;
> +               else if (! DOUBLE_SLASH_IS_DISTINCT_ROOT || 2 < p - base)
> +                 base = p - 1;
> +             }

This code doesn't seem to match the new comments for basename.
Furthermore, I don't see why the basename of "A:/" should be "/".  or
the basename of "//" should be "//".  The point of basename and
dirname is that if you concatenate them, with a slash between them,
then you get the same file.  But I don't see how this rule generalizes
to DOS under the proposed code.

Many of the rest of the changes look pretty complicated, and I didn't
take the time to review them, since I want to know what dirname and
basename are supposed to do before worrying about the details.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]