summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-06-01 02:23:06 +0000
committerRichard M. Stallman <rms@gnu.org>1996-06-01 02:23:06 +0000
commit183c3c592bb5a35cb39532a7a6db52ffc835edc0 (patch)
tree536c5af85eb41315d0dc1c7cdbb5cf23c4589143
parentf6b7af4e1e9fc17257c52633ee0d86abd4761a74 (diff)
downloademacs-183c3c592bb5a35cb39532a7a6db52ffc835edc0.tar.gz
(Fexpand_file_name) [WINDOWSNT]: Don't strip trailing /
when newdir is just "//". (Ffile_name_directory) [WINDOWSNT]: Return Qnil if filename is a partial UNC name such as "//foo".
-rw-r--r--src/fileio.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/fileio.c b/src/fileio.c
index f979cb2ab48..062f75ede81 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -348,6 +348,12 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.")
if (p == beg)
return Qnil;
+#ifdef WINDOWSNT
+ /* We can consider the partial UNC name //machine to be a
+ directory name, but not just // on its own. */
+ if (p == beg + 1 && IS_DIRECTORY_SEP (p[-1]))
+ return Qnil;
+#endif
#ifdef DOS_NT
/* Expansion of "c:" to drive and default directory. */
if (p == beg + 2 && beg[1] == ':')
@@ -1252,9 +1258,14 @@ See also the function `substitute-in-file-name'.")
if (newdir)
{
- /* Get rid of any slash at the end of newdir. */
+ /* Get rid of any slash at the end of newdir, unless newdir is
+ just // (an incomplete UNC name). */
length = strlen (newdir);
- if (IS_DIRECTORY_SEP (newdir[length - 1]))
+ if (IS_DIRECTORY_SEP (newdir[length - 1])
+#ifdef WINDOWSNT
+ && !(length == 2 && IS_DIRECTORY_SEP (newdir[0]))
+#endif
+ )
{
unsigned char *temp = (unsigned char *) alloca (length);
bcopy (newdir, temp, length - 1);