about summary refs log tree commit diff
path: root/Src/Modules/zpty.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2004-02-17 13:53:36 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2004-02-17 13:53:36 +0000
commit460e417caa50ecb7906b2cd3419c2a3c4588dd2e (patch)
tree7fa1c52c7c9de52dedb0a758f4475575adbb9a4b /Src/Modules/zpty.c
parent53c9db2406057e3641253e14737131de3cd4407f (diff)
downloadzsh-460e417caa50ecb7906b2cd3419c2a3c4588dd2e.tar.gz
zsh-460e417caa50ecb7906b2cd3419c2a3c4588dd2e.tar.xz
zsh-460e417caa50ecb7906b2cd3419c2a3c4588dd2e.zip
19429: configure test for ptmx
Diffstat (limited to 'Src/Modules/zpty.c')
-rw-r--r--Src/Modules/zpty.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index 7d33bd064..e1f75c30a 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -154,12 +154,10 @@ getptycmd(char *name)
     return NULL;
 }
 
-/**** maybe we should use configure here */
-/**** and we certainly need more/better #if tests */
+#if defined(HAVE_DEV_PTMX) && defined(HAVE_GRANTPT) && \
+    defined(HAVE_PTSNAME) && defined(HAVE_UNLOCKPT)
 
-#if defined(__SVR4) || defined(sinix) || defined(__CYGWIN__)
-
-#if !defined(__CYGWIN__)
+#ifdef HAVE_SYS_STROPTS_H
 #include <sys/stropts.h>
 #endif
 
@@ -192,7 +190,11 @@ get_pty(int master, int *retfd)
 	close(mfd);
 	return 1;
     }
-#if !defined(__CYGWIN__)
+#if defined(I_FIND) && defined(I_PUSH)
+    /*
+     * Use if STREAMS is available.  The test is probably OK,
+     * but we could use e.g. the sys/stropts.h test.
+     */
     if ((ret = ioctl(sfd, I_FIND, "ptem")) != 1)
        if (ret == -1 || ioctl(sfd, I_PUSH, "ptem") == -1) {
 	   close(mfd);
@@ -211,14 +213,14 @@ get_pty(int master, int *retfd)
 	   close(sfd);
 	   return 1;
        }
-#endif /* !defined(__CYGWIN__) */
+#endif
 
     *retfd = sfd;
 
     return 0;
 }
 
-#else /* ! (defined(__SVR4) || defined(sinix) || defined(__CYGWIN__)) */
+#else /* No /dev/ptmx or no pt functions */
 
 static int
 get_pty(int master, int *retfd)
@@ -267,7 +269,7 @@ get_pty(int master, int *retfd)
     return 1;
 }
 
-#endif /* __SVR4 */
+#endif /* /dev/ptmx or alternatives */
 
 static int
 newptycmd(char *nam, char *pname, char **args, int echo, int nblock)