Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: strange xterm & zsh behaviour



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:

--- init.c.orig	Fri Jan 29 04:10:39 1999
+++ init.c	Fri Jan 29 04:29:49 1999
@@ -328,11 +328,20 @@
 	zsfree(ttystrname);
 	ttystrname = ztrdup("/dev/tty");
     }
+#ifdef ALL_PRAISE_SUN
+/* 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/<terminal number here> 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.  -- <dave@xxxxxxx>          */
+    if (SHTTY == -1 && isatty(0) && (ttystrname = ztrdup(ttyname(0))))
+        SHTTY = movefd(dup(0));
+#endif
     if (SHTTY == -1) {
 	zsfree(ttystrname);
 	ttystrname = ztrdup("");
     }
-
     /* We will only use zle if shell is interactive, *
      * SHTTY != -1, and shout != 0                   */
     if (interact && SHTTY != -1) {



I'll leave the job of defining ALL_PRAISE_SUN to the maintainers. It
should be defined for Solaris 2.6 and above. In case Sun produces a patch
which fixes this problem, SHTTY won't be -1 and the bug fix code won't be
executed. Hopefully.

-- 
 .-.   .-.    Life is a sexually transmitted disease.
(_  \ /  _)
     |        dave@xxxxxxx
     |        dave@xxxxxxxxxxxxx




Messages sorted by: Reverse Date, Date, Thread, Author