[comp.windows.misc] MGR patch for SUN-OS 4.1

sau@breeze.bellcore.com (Stephen A Uhler) (07/31/90)

I finally found a Sun running OS 4.1, so here is the patch that lets MGR run.
It seems the semantics of the "read" system call was changed since 4.0.3
which causes the mouse to be a bit hesitant.

The only change is in src/set_mode.c

	*** NEW/set_mode.c
	--- OLD/set_mode.c
	***************
	*** 12,17 ****
	--- 12,18 ----
	  
	  /* muck with tty modes */
	  
	+ #include <fcntl.h>
	  #include <sgtty.h>
	  
	  /* set up tty input modes */
	***************
	*** 28,33 ****
	--- 29,35 ----
	  int file;				/* file descriptor */
	     {
	     set_mode(file,RAW,ECHO,B1200);
	+    fcntl(file,F_SETFL,fcntl(file,F_GETFL,0)|FNDELAY); /* for 4.1 */
	     return(ioctl(file,TIOCEXCL,0));
	     }
	  
In addition, it looks like /usr/ucb/vi uses terminfo instead of termcap,
so the set_termcap command isn't too useful.  The following shell script
will set the terminal size properly for terminfo:

	#!/bin/sh
	#       MGR set_terminfo for sun 4.1 (terminfo version of vi)  SAU 7/70
	
	ESC="^["  #   Fix to make the ^[ into the ESCAPE character
	stty -echo
	echo -n ${ESC}2I
	read rows cols xtra
	stty echo rows $rows cols $cols
	
In case you lost the terminfo entry supplied with MGR, this one should work ok:

	Px|mgr|SAU mgr teminal emulator,
		cols#80, lines#24,
		am, msgr,
		clear=^L, cr=^M, bel=^G,
		cub1=^H, cud1=\Ef, cuf1=\Er, cuu1=\Eu,
		ind=^J,
		cup=\E%p2%d;%p1%dM,
		csr=\E%p1%d;%p2%dt,
		wind=\E%p2%d;%p2%p4%+%d;%p1;%p1%p3%+%d;t,
		el=\Ec, ed=\EC,
		il1=\Ea, dl1=\Ed,
		il=\E%p1%da, dl=\E%p1%dd,
		smso=\Ei, rmso=\En,
		ht=^I,
		smcup=\E1664P, rmcup=\Et\Ep,