diff src/realpath.c @ 988:5df795348f45

[xemacs-hg @ 2002-09-01 22:13:52 by andyp] apply various 21.4 patches
author andyp
date Sun, 01 Sep 2002 22:14:58 +0000
parents 804517e16990
children 3bcd77d0bf93
line wrap: on
line diff
--- a/src/realpath.c	Sun Sep 01 17:54:58 2002 +0000
+++ b/src/realpath.c	Sun Sep 01 22:14:58 2002 +0000
@@ -216,14 +216,23 @@
     ;
 #ifdef WIN32_FILENAMES
   /* Check for c:/... or //server/... */
-  else if (abslen == 2 || abslen == 3)
+  else if (abslen == 3 || abslen == 2)
     {
-      qxestrncpy (new_path, path, abslen);
       /* Make sure drive letter is lowercased. */
-      if (abslen == 3)
-	*new_path = tolower (*new_path);
-      new_path += abslen;
-      path += abslen;
+      if (abslen == 3) {
+	*new_path = tolower (*path);
+	new_path++;
+	path++;
+	abslen--;
+      }
+      /* Coerce directory chars. */
+      while (abslen-- > 0) {
+	if (IS_DIRECTORY_SEP (*path))
+	  *new_path++ = DIRECTORY_SEP;
+	else
+	  *new_path++ = *path;
+	path++;
+      }
     }
 #endif
 #ifdef WIN32_NATIVE