From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9909 invoked from network); 16 Mar 2004 15:07:38 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 16 Mar 2004 15:07:38 -0000 Received: (qmail 17000 invoked by alias); 16 Mar 2004 15:07:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19629 Received: (qmail 16990 invoked from network); 16 Mar 2004 15:07:32 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 16 Mar 2004 15:07:32 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.58.19] by sunsite.dk (MessageWall 1.0.8) with SMTP; 16 Mar 2004 15:7:32 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i2GF7Vv15327 for ; Tue, 16 Mar 2004 15:07:31 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Tue, 16 Mar 2004 15:07:09 +0000 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Tue, 16 Mar 2004 15:09:44 +0000 To: Zsh workers Subject: PATCH: zpty on HP/UX In-reply-to: "Peter Stephenson"'s message of "Mon, 15 Mar 2004 17:11:31 GMT." <5306.1079370691@csr.com> Date: Tue, 16 Mar 2004 15:07:30 +0000 Message-ID: <28264.1079449650@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 16 Mar 2004 15:09:44.0086 (UTC) FILETIME=[B693CB60:01C40B68] > 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 #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 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 **********************************************************************