Subject: Re: 9term under Linux?

From: Aharon Robbins <[email-masked]>
Date: Thu, 28 Jan 1999 06:33:33 -0500

Me:
> > I know this has come up before, but I don't remember the answers...
> > Has anyone got patches to 9term 1.6.6 for Linux?  I have it built, but
> > hold mode isn't working.  And with the latest rc as the shell,
> > input characters are not echoed.
> > 
> > I'm using Redhat 5.2, if that matters.

From: "James A. Robinson" <[email-masked]>
> Yes, I have it working. As I recall, I had to nab a patch off the net.  A
> quick search gave this: http://cm.bell-labs.com/who/rsc/linux/9term.patch
> which I think is what I used.

This is for 1.6.3.  But it was enough to get me started.  After a whopping
5 minutes of testing, rc and hold mode work.  Here's a diff against
the 1.6.6 sources.  I can supply the makefile I used too, if anyone
wants it; the main thing is to define _POSIX_SOURCE and LINUX.

Now, to try restarting X with 9wm as the window manager...

Much thanks!

Arnold
--------------------------------
*** 9term.c.dist	Thu Sep 28 06:16:15 1995
--- 9term.c	Thu Jan 28 13:15:36 1999
***************
*** 10,16 ****
  #include <frame.h>
  #include <text.h>
  
! #ifdef SOLARIS
  #include <sys/termios.h>
  #else
  #include <sys/termio.h>
--- 10,16 ----
  #include <frame.h>
  #include <text.h>
  
! #if defined SOLARIS || defined LINUX
  #include <sys/termios.h>
  #else
  #include <sys/termio.h>
*** 9term.h.dist	Tue Nov 28 07:27:04 1995
--- 9term.h	Thu Jan 28 13:14:56 1999
***************
*** 30,35 ****
--- 30,39 ----
  extern int		echo;
  extern int		isig;
  
+ #if	defined(LINUX)
+ #define	setenv	p9term_setenv
+ #endif
+ 
  extern void		specialchars(int);
  extern int		setenv(char *, char *, int);
  extern void		init_display(int *, char **, char**, char*);
***************
*** 87,90 ****
--- 91,99 ----
  #if	defined(SOLARIS)
  #define	POSIXPTYS
  #define	REMOTE
+ #endif
+ 
+ #if	defined(LINUX)
+ #define POSIXPTYS
+ #define BSDPTYS
  #endif
*** display.c.dist	Thu Oct  5 09:55:54 1995
--- display.c	Thu Jan 28 13:10:28 1999
***************
*** 275,280 ****
--- 275,287 ----
  {
  	int width, height;
  
+ 	static int called=0;
+ 	
+ 	if (called) {
+ 		/*fprintf(stderr, "ereshaped called twice\n");*/
+ 		return;
+ 	}
+ 	called = 1;
  	if (ninewm) {
  		/* work around textsetrects wierdness */
  		r = inset(r, -3);
***************
*** 286,291 ****
--- 293,299 ----
  		tty_set_size(comm_fd, width, height, Dx(text->r), Dy(text->r));
  		setborder();
  	}
+ 	called = 0;
  }
  
  /*
*** pty.c.dist	Tue Nov 28 07:30:45 1995
--- pty.c	Thu Jan 28 13:22:07 1999
***************
*** 60,73 ****
  #	define	V_FLUSH VFLUSH
  #endif
  
! #ifdef	linux
  #	define	V_START VSTART
  #	define	V_STOP VSTOP
  #	define	V_SUSP VSUSP
  #	define	V_DSUSP VDSUSP
  #	define	V_RPRNT VREPRINT
  #	define	V_WERAS VWERASE
- #	define	V_FLUSH VFLUSH
  #endif
  
  #ifdef	HPUX
--- 60,73 ----
  #	define	V_FLUSH VFLUSH
  #endif
  
! #ifdef	LINUX
! #include <pty.h>
  #	define	V_START VSTART
  #	define	V_STOP VSTOP
  #	define	V_SUSP VSUSP
  #	define	V_DSUSP VDSUSP
  #	define	V_RPRNT VREPRINT
  #	define	V_WERAS VWERASE
  #endif
  
  #ifdef	HPUX
***************
*** 304,309 ****
--- 304,312 ----
  		ttmode.c_lflag |= ECHO;
  		ttmode.c_oflag &= ~(ONLCR);
  		ttmode.c_oflag |= ONLRET;
+ #ifdef	LINUX
+ 		ttmode.c_lflag |= ICANON;
+ #endif
  	} else {
  		ttmode.c_iflag = BRKINT | IGNPAR | ICRNL | IXON;
  		ttmode.c_oflag = OPOST | ONLRET;
--
Aharon (a.k.a. Arnold) Robbins		[email-masked]
P.O. Box 354			Home Phone: +972  8 979-0381
Nof Ayalon			Cell Phone: +972 51  297-545
D.N. Shimshon 99784		Laundry increases exponentially in the
ISRAEL				number of children. -- Miriam Robbins

---

From: Bengt Kleberg <[email-masked]>
Date: Thu, 28 Jan 1999 02:45:29 -0500

> input characters are not echoed.

I have a 9term that works under Linux. Both hold mode and latest rc.
Unfortunatly I do not remember how I built it!

If nobody else steps forward with the right thing I could try and find out.

Best Wishes, Bengt
===============================================================
Everything aforementioned should be regarded as totally private
opinions, and nothing else. [email-masked]
``His great strength is that he is uncompromising. It would make
him physically ill to think of programming in C++.''

---

From: Aharon Robbins <[email-masked]>
Date: Tue, 2 Feb 1999 01:49:04 -0500

> I read some articles of Aharon's (Arnold's) in 1995 "Linux Journal"
> and had the old R. Pike 'sam' article, and have been 'window shopping'
> (where in this case 'window' has nothing to do with Microsoft) with
> the intent of maybe putting together some no name x86 system.
>
> So when I read here that Arnold has difficulties, I think, Maybe I'm
> over my head, if *HE* has problems, what am I going to run into?! 

Don't be discouraged.  The patches I posted to sam-fans for 9term
do the trick. My problem with interrupts were 1) I forgot that 9term
uses DEL, not ^C, and 2) I was running es-0.84 in the 9term, not rc.
I will be switching to rc.

> So my question is, e.g., Jim, what are you using? Is there a general
> consensus on ease of installation, whatever, getting this p9 'look and
> feel grafted on top of what version of Unix? Are there known problems
> with (obviously) RedHat vs. whatever?

I sent bobf Make.linux files and diffs to u.h for linux so that will
be in the sam distribution soon. (Patches available on request, but
they're pretty easy to do on your own.) The patches I sent for 9term
1.6.6 seem to do the trick.

I am now happily running the 9wm/9term/9menu/sam/rc combination.
After 1.5 years without X, it's like having an old friend back. :-)

To answer your question, for my money, stick w/Linux.  (No, I don't want
to start a religious war.  To each his own, etc.)

> BTW, Aharon/Arnold: I enjoyed your LJ articles enough that I'm
> planning to get your AWK book just because I assume it will be well
> written also.

Thanks.  *I* think it's pretty good, but I'm sorta biased. OTOH, I
have yet to have anyone tell me it sucked... :-)

Arnold

---

From: Chris Siebenmann <cks>
Date: Tue, 2 Feb 1999 15:41:27 -0500

| So my question is, e.g., Jim, what are you using? Is there a general
| consensus on ease of installation, whatever, getting this p9 'look and
| feel grafted on top of what version of Unix? Are there known problems
| with (obviously) RedHat vs. whatever?

 I find that my version of 9term (it started out at 1.6.6 and grew) is
about equally easy to bring up on anything. The fiddling required is
usually to set up the V_* defines, almost always to not use TCSADRAIN,
and some functions that are prototyped in standard header files in ways
that clash with u.h et al.

 I have similar results for sam and rc (generally).

 They're all Unix. They all work.

	- cks, who's lost count of how many Unixes he's made 9term run on

---

From: Bengt Kleberg <[email-masked]>
Date: Wed, 3 Feb 1999 02:19:46 -0500

> 	- cks, who's lost count of how many Unixes he's made 9term run on

BSD too? My 9term for BSD does not work properly (unexplainable freezes
at times). May I look at your 9term, please?

Best Wishes, Bengt