From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes Resent-Date: Fri, 29 Jan 1999 04:33:11 -0500 (EST) Message-Id: <9901290916.AA53082@ibmth.df.unipi.it> To: zsh-workers@math.gatech.edu Cc: Drazen Kacar Subject: PATCH: 3.1.5* & 3.0.5: Re: strange xterm & zsh behaviour In-Reply-To: "Drazen Kacar"'s message of "Fri, 29 Jan 1999 04:47:46 NFT." <19990129044746.A21036@jagor.srce.hr> Date: Fri, 29 Jan 1999 10:16:30 +0100 From: Peter Stephenson Resent-Message-ID: <"5d9I13.0.7F.N1Ois"@math> Resent-From: zsh-workers@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Resent-Sender: zsh-workers-request@math.gatech.edu X-Mailing-List: 5103 Drazen Kacar wrote: > Drazen Kacar wrote: > > > > } Control keys and arrow keys don't work any > > > } more. The shell just echos ^[[A (for example) instead of scrolling > > > } through the history list. Ctrl-C is being echoed as ^C and the shell > > > } doesn't prompt in a new line. > > Here's the patch for zsh 3.0.5 which fixes that: The code for 3.1.5 is similar, so the same ought to work. It's pretty much impossible to test in configure, and it'll only try it if it really needs it, so probably it's OK to have the code run for all OSes. The worst that can happen is that you get a read-only terminal, but the alternative is no terminal at all. I added a free for ttystrname to match the other bits. Any more comments? *** Src/init.c.tty Thu Dec 17 12:17:04 1998 --- Src/init.c Fri Jan 29 10:13:19 1999 *************** *** 309,314 **** --- 309,330 ---- zsfree(ttystrname); ttystrname = ztrdup("/dev/tty"); } + /* + * xterm, rxvt and probably all terminal emulators except dtterm on + * Solaris 2.6 & 7 have a bug. Applications are unable to open /dev/tty + * or /dev/pts/ because something in Sun's STREAMS + * modules doesn't like it. The open() call fails with EBUSY which + * is not even listed as a possibility in the open(2) man page. + * So we'll try to outsmart The Company. -- + * + * Presumably there's no harm trying this on any OS, given that + * isatty(0) worked but opening the tty didn't. Possibly we won't + * get the tty read/write, but it's the best we can do -- pws + */ + if (SHTTY == -1 && isatty(0) && (SHTTY = movefd(dup(0))) != -1) { + zsfree(ttystrname); + ttystrname = ztrdup(ttyname(0)); + } if (SHTTY == -1) { zsfree(ttystrname); ttystrname = ztrdup(""); -- Peter Stephenson Tel: +39 050 844536 WWW: http://www.ifh.de/~pws/ Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy