about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrey Borzenkov <bor@users.sourceforge.net>2001-01-26 12:47:37 +0000
committerAndrey Borzenkov <bor@users.sourceforge.net>2001-01-26 12:47:37 +0000
commite28d948e9276de9fe48e14e6fb007cd262303792 (patch)
tree5d7db1b5c4e50140ec136bae576128042f66a6e8
parent193846af847cb469d69611e84955486808c4ec6f (diff)
downloadzsh-e28d948e9276de9fe48e14e6fb007cd262303792.tar.gz
zsh-e28d948e9276de9fe48e14e6fb007cd262303792.tar.xz
zsh-e28d948e9276de9fe48e14e6fb007cd262303792.zip
13389: normalize path in cd_do_chdir on Cygwin to get rid of DOS names
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c29
2 files changed, 28 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index ed84451e6..b67841efe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2001-01-26  Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
+
+	* 13389: Src/builtin.c: on Cygwin convert path to posix form in
+	cd_do_chdir() to avoid dealing with driver letters
+
 2001-01-25  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 13388: Src/Zle/compmatch.c: fix for mergin two CLF_MID entries
diff --git a/Src/builtin.c b/Src/builtin.c
index 1d54804d1..8a33a5312 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -836,14 +836,31 @@ cd_do_chdir(char *cnam, char *dest, int hard)
 {
     char **pp, *ret;
     int hasdot = 0, eno = ENOENT;
-    /* nocdpath indicates that cdpath should not be used.  This is the case iff
-    dest is a relative path whose first segment is . or .., but if the path is
-    absolute then cdpath won't be used anyway. */
-    int nocdpath = dest[0] == '.' &&
-    (dest[1] == '/' || !dest[1] || (dest[1] == '.' &&
+    /*
+     * nocdpath indicates that cdpath should not be used.
+     * This is the case iff dest is a relative path
+     * whose first segment is . or .., but if the path is
+     * absolute then cdpath won't be used anyway.
+     */
+    int nocdpath;
+#ifdef __CYGWIN__
+    /*
+     * Normalize path under Cygwin to avoid messing with
+     * DOS style names with drives in them
+     */
+    static char buf[PATH_MAX];
+    void cygwin_conv_to_posix_path(const char *, char *);
+
+    cygwin_conv_to_posix_path(dest, buf);
+    dest = buf;
+#endif
+    nocdpath = dest[0] == '.' &&
+		(dest[1] == '/' || !dest[1] || (dest[1] == '.' &&
 				    (dest[2] == '/' || !dest[2])));
 
-    /* if we have an absolute path, use it as-is only */
+    /*
+     * If we have an absolute path, use it as-is only
+     */
     if (*dest == '/') {
 	if ((ret = cd_try_chdir(NULL, dest, hard)))
 	    return ret;