zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "ZSH workers mailing list" <zsh-workers@sunsite.auc.dk>
Subject: PATCH: cd d:/foo under Cygwin
Date: Fri, 26 Jan 2001 14:01:13 +0300	[thread overview]
Message-ID: <000101c08787$4c125b20$21c9ca95@mow.siemens.ru> (raw)

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;


                 reply	other threads:[~2001-01-26 11:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000101c08787$4c125b20$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).