# HG changeset patch # User Richard M. Stallman # Date 895716381 0 # Node ID e0f5d24380017edeed372dfb7ffb386a69a10fc4 # Parent e23d16d11ba9f86849e2f7e281cf0c3b7ea798a0 (Ffile_name_directory, Ffile_name_nondirectory) [DOS_NT]: Handle the special construct "/:" when followed by d:foo. diff -r e23d16d11ba9 -r e0f5d2438001 src/fileio.c --- a/src/fileio.c Thu May 21 02:05:53 1998 +0000 +++ b/src/fileio.c Thu May 21 02:06:21 1998 +0000 @@ -382,8 +382,11 @@ && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' #endif /* VMS */ #ifdef DOS_NT - /* only recognise drive specifier at beginning */ - && !(p[-1] == ':' && p == beg + 2) + /* only recognise drive specifier at the beginning */ + && !(p[-1] == ':' + /* handle the "/:d:foo" and "/:foo" cases correctly */ + && ((p == beg + 2 && !IS_DIRECTORY_SEP (*beg)) + || (p == beg + 4 && IS_DIRECTORY_SEP (*beg)))) #endif ) p--; @@ -391,11 +394,20 @@ return Qnil; #ifdef DOS_NT /* Expansion of "c:" to drive and default directory. */ - if (p == beg + 2 && beg[1] == ':') + if (p[-1] == ':') { /* MAXPATHLEN+1 is guaranteed to be enough space for getdefdir. */ unsigned char *res = alloca (MAXPATHLEN + 1); - if (getdefdir (toupper (*beg) - 'A' + 1, res)) + unsigned char *r = res; + + if (p == beg + 4 && IS_DIRECTORY_SEP (*beg) && beg[1] == ':') + { + strncpy (res, beg, 2); + beg += 2; + r += 2; + } + + if (getdefdir (toupper (*beg) - 'A' + 1, r)) { if (!IS_DIRECTORY_SEP (res[strlen (res) - 1])) strcat (res, "/"); @@ -440,7 +452,9 @@ #endif /* VMS */ #ifdef DOS_NT /* only recognise drive specifier at beginning */ - && !(p[-1] == ':' && p == beg + 2) + && !(p[-1] == ':' + /* handle the "/:d:foo" case correctly */ + && (p == beg + 2 || (p == beg + 4 && IS_DIRECTORY_SEP (*beg)))) #endif ) p--;