[comp.sys.xerox] A small utility for CHATting with UNIX

james@sparrmsuucp (James Buchanan) (11/30/88)

A little bit of ADVICE allows CHAT to tell UNIX about the size of
its window in rows and columns every time one is opened or reshaped. 
This allows you to use full screen UNIX utilities with any size of
CHAT window. It is especially nice when using vi or reading mail.

What you have to do is add the following advice:

	(ADVISE 'CHAT.SCREENPARAMS 'AFTER 'FIRST '(CHAT.SETTY WINDOW))

Where CHAT.SETTY is defined as follows:

(DEFINEQ

(  CHAT.SETTY  
  (LAMBDA (WINDOW)                                                
    (  DECLARE   (SPECVARS CHAT.SETTY))
    (LET* ((STRING (WINDOWPROP WINDOW 'TITLE))
           (HSTART (STRPOS "height = " STRING NIL NIL NIL T))
           (HEND (SUB1 (STRPOS "," STRING HSTART)))
           (WSTART (STRPOS "width = " STRING NIL NIL NIL T))
           (WEND (NCHARS STRING))
           (HEIGHT (MKATOM (SUBSTRING STRING HSTART HEND)))
           (WIDTH (MKATOM (SUBSTRING STRING WSTART WEND))))
          (TTY.PROCESS (WINDOWPROP WINDOW 'PROCESS))
          (COND
             (  CHAT.SETTY   (BKSYSBUF (CONCAT "stty rows " 
		  HEIGHT " columns " WIDTH (CHARACTER 13)))))))))


Here the global variable CHAT.SETTY is just used to allow the user 
to disable the advice if he/she wishes. Note that this advice 
pumps the "stty ..." string to whatever process is listening on
the SUN, so it shouldn't be triggered if you are anywhere but in
the shell.


James Buchanan				james@sparrms.UUCP
Spar Aerospace Ltd		
1700 Ormont Drive			(416) 745-9680
Weston, Ontario, CANADA  M9L 2W7