changeset 8185:b5cc015a3698

(Ffile_name_directory, Ffile_name_nondirectory, file_name_as_directory, directory_file_name, Fexpand_file_name, Ffile_name_absolute_p, Fsubstitute_in_file_name) [MSDOS]: Allow backslashed file names.
author Richard M. Stallman <rms@gnu.org>
date Sat, 09 Jul 1994 19:10:16 +0000
parents 8ccef13ebe58
children 9e650e1fe909
files src/fileio.c
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/fileio.c	Sat Jul 09 19:04:27 1994 +0000
+++ b/src/fileio.c	Sat Jul 09 19:10:16 1994 +0000
@@ -290,7 +290,7 @@
 	 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>'
 #endif /* VMS */
 #ifdef MSDOS
-	 && p[-1] != ':'
+	 && p[-1] != ':' && p[-1] != '\\'
 #endif
 	 ) p--;
 
@@ -345,7 +345,7 @@
 	 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>'
 #endif /* VMS */
 #ifdef MSDOS
-	 && p[-1] != ':'
+	 && p[-1] != ':' && p[-1] != '\\'
 #endif
 	 ) p--;
 
@@ -443,7 +443,7 @@
 #else /* not VMS */
   /* For Unix syntax, Append a slash if necessary */
 #ifdef MSDOS
-  if (out[size] != ':' && out[size] != '/')
+  if (out[size] != ':' && out[size] != '/' && out[size] != '\\')
 #else
   if (out[size] != '/')
 #endif
@@ -623,9 +623,11 @@
      But leave "/" unchanged; do not change it to "".  */
   strcpy (dst, src);
   if (slen > 1 
+#ifdef MSDOS
+      && (dst[slen - 1] == '/' || dst[slen - 1] == '/')
+      && dst[slen - 2] != ':'
+#else
       && dst[slen - 1] == '/'
-#ifdef MSDOS
-      && dst[slen - 2] != ':'
 #endif
       )
     dst[slen - 1] = 0;
@@ -764,7 +766,10 @@
   nm = XSTRING (name)->data;
   
 #ifdef MSDOS
-  /* firstly, strip drive name. */
+  /* First map all backslashes to slashes.  */
+  dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm));
+
+  /* Now strip drive name. */
   {
     unsigned char *colon = rindex (nm, ':');
     if (colon)
@@ -1487,6 +1492,10 @@
   CHECK_STRING (string, 0);
 
   nm = XSTRING (string)->data;
+#ifdef MSDOS
+  dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm));
+  substituted = !strcmp (nm, XSTRING (string)->data);
+#endif
   endp = nm + XSTRING (string)->size;
 
   /* If /~ or // appears, discard everything through first slash. */
@@ -2139,7 +2148,7 @@
 	  && ptr[1] != '.')
 #endif /* VMS */
 #ifdef MSDOS
-      || (*ptr != 0 && ptr[1] == ':' && ptr[2] == '/')
+      || (*ptr != 0 && ptr[1] == ':' && (ptr[2] == '/' || ptr[2] == '\\'))
 #endif
       )
     return Qt;