home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pipex!bnr.co.uk!uknet!acorn!steve
- From: steve@acorn.co.uk (Steve "daffy" Hunt)
- Newsgroups: comp.sys.acorn.tech
- Subject: Re: MicroEmacs 3.11c/RISCiX
- Message-ID: <20903@acorn.co.uk>
- Date: 4 Jan 93 16:34:08 GMT
- References: <1hlfkeINNbu1@swan.doc.ic.ac.uk>
- Organization: Acorn Computers Limited, Cambridge, UK
- Lines: 180
- X-Newsreader: TIN [version 1.1 PL8]
-
- M Y Ben Gershon (mybg@doc.ic.ac.uk) wrote:
- : Manybe someone at Aocrn who knows about RISCiX can help?
-
-
- Basically it's very easy; intercept SIGWINCH. The patch below
- is what I did to incorporate it into 3.9; I'm sure it could
- be adapted to work on more recent versions.
-
- Our source tree contains the following log entry:-
-
- 1.3: bsd.2
- 88/09/23 13:40:25; author: steve
- Made BSD version follow changes in window size. Dependent on the
- flag FOLLOW_WINDOW_SIZE in estruct.h. Modules affected: estruct.h,
- tcap.c
-
- -- Steve
-
- ---------------- CUT HERE ----------------
- *** old/estruct.h Mon Jan 4 16:28:14 1993
- --- estruct.h Fri Sep 23 14:40:25 1988
- ***************
- *** 112,117 ****
- --- 112,126 ----
- #define ASCII 1 /* always using ASCII char sequences for now */
- #define EBCDIC 0 /* later IBM mainfraim versions will use EBCDIC */
-
- + #define FOLLOW_WINDOW_SIZE 1 /* BSD only; if the kernel's idea of */
- + /* window size is sensible, use it */
- + /* rather than the size gleaned from */
- + /* TERMCAP. Also, follow any SIGWINCH */
- + /* signals that come along. */
- +
- + #define WINDOW_MAX_ROWS 100 /* if FOLLOW_WINDOW_SIZE, then restrict */
- + #define WINDOW_MAX_COLS 200 /* window to being this size */
- +
- /* System dependant library redefinitions, structures and includes */
-
- #if TURBO
- *** old/tcap.c Mon Jan 4 16:28:25 1993
- --- tcap.c Mon Jan 4 16:29:31 1993
- ***************
- *** 10,15 ****
- --- 10,20 ----
-
- #if TERMCAP
-
- + #if BSD && FOLLOW_WINDOW_SIZE
- + #include <sys/ioctl.h>
- + #include <signal.h>
- + #endif
- +
- #define MARGIN 8
- #define SCRSIZ 64
- #define NPAUSE 10 /* # times thru update to pause */
- ***************
- *** 69,74 ****
- --- 74,106 ----
- #endif
- };
-
- + #if (BSD) && (FOLLOW_WINDOW_SIZE)
- +
- + /*
- + * Signal handler for any SIGWINCH signals that might appear.
- + */
- +
- + window_changed () {
- + int mycols, myrows;
- + struct winsize wininfo;
- +
- + signal (SIGWINCH, SIG_IGN);
- + if (ioctl (1, TIOCGWINSZ, &wininfo) == 0) {
- + /* ioctl successful */
- + myrows = wininfo.ws_row;
- + mycols = wininfo.ws_col;
- + if (myrows > 0 && mycols > 0) {
- + if (myrows - 1 > term.t_mrow) myrows = term.t_mrow;
- + if (mycols > term.t_mcol) mycols = term.t_mcol;
- + newsize (TRUE, myrows);
- + newwidth (TRUE, mycols);
- + }
- + }
- + update (TRUE);
- + signal (SIGWINCH, window_changed);
- + }
- + #endif
- +
- tcapopen()
-
- {
- ***************
- *** 91,108 ****
- exit(1);
- }
-
- ! if ((term.t_nrow=(short)tgetnum("li")-1) == -1){
- ! puts("termcap entry incomplete (lines)");
- ! exit(1);
- ! }
- term.t_mrow = term.t_nrow;
-
- ! if ((term.t_ncol=(short)tgetnum("co")) == -1){
- ! puts("Termcap entry incomplete (columns)");
- ! exit(1);
- ! }
- term.t_mcol = term.t_ncol;
-
- p = tcapbuf;
- t = tgetstr("pc", &p);
- if(t)
- --- 123,187 ----
- exit(1);
- }
-
- ! #if BSD && FOLLOW_WINDOW_SIZE
- !
- ! term.t_mrow = WINDOW_MAX_ROWS; /* max size that the screen can attain */
- ! term.t_mcol = WINDOW_MAX_COLS;
- !
- ! /* Prefer the screen dimensions as the kernel believes */
- ! /* If this has silly entries (0) then use termcap-specified sizes */
- !
- ! { struct winsize wininfo;
- ! int window_size_sensible = FALSE;
- !
- ! if (ioctl (1, TIOCGWINSZ, &wininfo) == 0)
- ! {
- ! if (wininfo.ws_row > 0 && wininfo.ws_col > 0)
- ! {
- ! term.t_nrow = wininfo.ws_row - 1;
- ! term.t_ncol = wininfo.ws_col - 1;
- ! window_size_sensible = TRUE;
- ! }
- ! }
- !
- ! if (!window_size_sensible)
- ! {
- ! /* Try for termcap's window size */
- ! if ((term.t_nrow=(short)tgetnum("li")-1) == -1)
- ! {
- ! puts("termcap entry incomplete (lines)");
- ! exit(1);
- ! }
- !
- ! if ((term.t_ncol=(short)tgetnum("co")) == -1)
- ! {
- ! puts("Termcap entry incomplete (columns)");
- ! exit(1);
- ! }
- ! }
- ! }
- !
- ! if (term.t_nrow > term.t_mrow) term.t_nrow = term.t_mrow;
- ! if (term.t_ncol > term.t_mcol) term.t_ncol = term.t_mcol;
- !
- ! signal (SIGWINCH, window_changed);
- !
- ! #else
- !
- ! if ((term.t_nrow=(short)tgetnum("li")-1) == -1){
- ! puts("termcap entry incomplete (lines)");
- ! exit(1);
- ! }
- term.t_mrow = term.t_nrow;
-
- ! if ((term.t_ncol=(short)tgetnum("co")) == -1){
- ! puts("Termcap entry incomplete (columns)");
- ! exit(1);
- ! }
- term.t_mcol = term.t_ncol;
-
- + #endif
- +
- p = tcapbuf;
- t = tgetstr("pc", &p);
- if(t)
- ---------------- CUT HERE ----------------
- --
- Steve Hunt steve@acorn.co.uk
-