Mercurial > hg > octave-lyh > gnulib-hg
changeset 2171:0549d611c7b4
(dir_name): Support for DOS-style file names with drive letters.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Sat, 22 Jan 2000 21:29:02 +0000 |
parents | 592f131dc887 |
children | b56c209a59b7 |
files | lib/dirname.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/dirname.c +++ b/lib/dirname.c @@ -57,8 +57,17 @@ 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; }