Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: cd d:/foo under Cygwin
- X-seq: zsh-workers 13389
- From: "Andrej Borsenkow" <Andrej.Borsenkow@xxxxxxxxxxxxxx>
- To: "ZSH workers mailing list" <zsh-workers@xxxxxxxxxxxxxx>
- Subject: PATCH: cd d:/foo under Cygwin
- Date: Fri, 26 Jan 2001 14:01:13 +0300
- Importance: Normal
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Absolute path with drive name in it was treated as relative by zsh. I was
unsure how to handle it; finally I just added conversion to posix path (it was
less messy than adding check for initial driver letter).
It has interesting side effect. In default installation if you cd /bin it is
O.K. but if you cd c:/cygwin/bin (that should be the same directory) you end
up in /usr/bin. This is due to mount tables set up by Cygwin.
-andrej
Have a nice DOS!
B >>
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.40
diff -u -r1.40 builtin.c
--- Src/builtin.c 2001/01/16 13:44:20 1.40
+++ Src/builtin.c 2001/01/26 10:15:16
@@ -836,14 +836,31 @@
{
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;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author