about summary refs log tree commit diff
path: root/Src/compat.c
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:14:01 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-04-15 18:14:01 +0000
commit850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b (patch)
treea09f4376fe75073ed19fb5dd1de0fce4c898adb9 /Src/compat.c
parent7a40d6c258ad87d147ee5d6839e746c33ebc0ac7 (diff)
downloadzsh-850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b.tar.gz
zsh-850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b.tar.xz
zsh-850fb2e7f94b4e0e9fbf3538ad9e3c44c9fed74b.zip
zsh-3.1.5-pws-7 zsh-3.1.5-pws-7
Diffstat (limited to 'Src/compat.c')
-rw-r--r--Src/compat.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/Src/compat.c b/Src/compat.c
index ca9c57aac..b1bcbc21b 100644
--- a/Src/compat.c
+++ b/Src/compat.c
@@ -111,12 +111,17 @@ zgetdir(struct dirsav *d)
 {
     char nbuf[PATH_MAX+3];
     char *buf;
-    int bufsiz, pos, len;
+    int bufsiz, pos;
     struct stat sbuf;
+    ino_t pino;
+    dev_t pdev;
+#ifndef __CYGWIN__
     struct dirent *de;
     DIR *dir;
-    ino_t ino, pino;
-    dev_t dev, pdev;
+    dev_t dev;
+    ino_t ino;
+    int len;
+#endif
 
     buf = halloc(bufsiz = PATH_MAX);
     pos = bufsiz - 1;
@@ -137,6 +142,7 @@ zgetdir(struct dirsav *d)
 #ifdef HAVE_FCHDIR
     else
 #endif
+#ifndef __CYGWIN__
 	holdintr();
 
     for (;;) {
@@ -221,6 +227,21 @@ zgetdir(struct dirsav *d)
     if (*buf)
 	zchdir(buf + pos + 1);
     noholdintr();
+
+#else  /* __CYGWIN__ case */
+
+    if (!getcwd(buf, bufsiz)) {
+	if (d) {
+	    return NULL;
+	}
+    } else {
+	if (d) {
+	    return d->dirname = ztrdup(buf);
+	}
+	return buf;
+    }
+#endif
+
     buf[0] = '.';
     buf[1] = '\0';
     return buf;