Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: zpty on HP/UX
- X-seq: zsh-workers 19629
- From: Peter Stephenson <pws@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxxxxx>
- Subject: PATCH: zpty on HP/UX
- Date: Tue, 16 Mar 2004 15:07:30 +0000
- In-reply-to: "Peter Stephenson"'s message of "Mon, 15 Mar 2004 17:11:31 GMT." <5306.1079370691@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
> Unless someone turns out to be a secret STREAMS expert we are stuck with
> doing it machine by machine, i.e. adding __hpux where necessary.
> I don't see a good reason for changing from __SVR4 for the other case.
Here's a patch which doesn't screw up Solaris, at least.
Index: Src/Modules/zpty.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zpty.c,v
retrieving revision 1.30
diff -u -r1.30 zpty.c
--- Src/Modules/zpty.c 26 Feb 2004 20:48:09 -0000 1.30
+++ Src/Modules/zpty.c 16 Mar 2004 14:47:05 -0000
@@ -160,12 +160,31 @@
#include <sys/stropts.h>
#endif
+#if defined(I_FIND) && defined(I_PUSH)
+/*
+ * These tests are ad hoc. Unfortunately if you get the wrong ioctl,
+ * STREAMS simply hangs up, so there's no obvious way of doing this
+ * more systematically.
+ *
+ * Apparently Solaris needs all three ioctls, but HP-UX doesn't need
+ * ttcompat. The Solaris definition has been extended to all __SVR4
+ * as a guess; I have no idea if this is right.
+ */
+#ifdef __SVR4
+#define USE_STREAMS_IOCTLS
+#define USE_STREAMS_TTCOMPAT
+#endif
+#ifdef __hpux
+#define USE_STREAMS_IOCTLS
+#endif
+#endif
+
static int
get_pty(int master, int *retfd)
{
static char *name;
static int mfd, sfd;
-#if defined(I_FIND) && defined(I_PUSH) && defined(__SVR4)
+#ifdef USE_STREAMS_IOCTLS
int ret;
#endif
@@ -190,11 +209,7 @@
close(mfd);
return 1;
}
-#if defined(I_FIND) && defined(I_PUSH) && defined(__SVR4)
- /*
- * Use if STREAMS is available. The test is probably OK,
- * but we could use e.g. the sys/stropts.h test.
- */
+#ifdef USE_STREAMS_IOCTLS
if ((ret = ioctl(sfd, I_FIND, "ptem")) != 1)
if (ret == -1 || ioctl(sfd, I_PUSH, "ptem") == -1) {
close(mfd);
@@ -207,6 +222,7 @@
close(sfd);
return 1;
}
+#ifdef USE_STREAMS_TTCOMPAT
if ((ret = ioctl(sfd, I_FIND, "ttcompat")) != 1)
if (ret == -1 || ioctl(sfd, I_PUSH, "ttcompat") == -1) {
close(mfd);
@@ -214,6 +230,7 @@
return 1;
}
#endif
+#endif
*retfd = sfd;
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author