mirror of
https://github.com/coreutils/coreutils.git
synced 2024-12-04 23:43:45 +08:00
(dir_name): Support for DOS-style file names with drive letters.
This commit is contained in:
parent
a2e435c395
commit
09f1b5f940
@ -57,8 +57,17 @@ dir_name (const char *path)
|
||||
else
|
||||
{
|
||||
/* Remove any trailing slashes from the result. */
|
||||
#ifdef MSDOS
|
||||
char *lim = (path[0] >= 'A' && path[0] <= 'z' && path[1] == ':')
|
||||
? path + 2 : path;
|
||||
|
||||
/* If canonicalized "d:/path", leave alone the root case "d:/". */
|
||||
while (slash > lim && *slash == '/')
|
||||
--slash;
|
||||
#else
|
||||
while (slash > path && *slash == '/')
|
||||
--slash;
|
||||
#endif
|
||||
|
||||
length = slash - path + 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user