On Wed, Nov 12, 2014 at 07:34:28PM +0100, Martin Natano wrote: > The 'struct _gs' type (aka. GS) contains pointers to screen interface > functions, which are set by cl_func_std(), but this mechanism isn't > necessary anymore, because the other frontends (tk, motif, ipc) have > been removed. The only remaining frontend is curses and can be used > directly. The only exception is the scr_msg function pointer, which is > used by the perl api (disabled by default) and thus must remain in GS. > > Also, the tcl_interp, ip_private and tk_private fields are unused and > can be removed.
Below is an updated version of the patch, which applies cleanly to vi as it is in CVS now. I killed scr_msg, because the last user (the perl api) is now gone. This diff is mostly a mechanical change from scr_* to cl_* (or vs_* in the cases of scr_busy and scr_msg). The benefit is, that the global state is used less, and the code should be more readable, as less indirections are involved when a function is called. Does anyone want to commit that? > See the diff below. > > cheers, > natano Index: cl/cl_funcs.c =================================================================== RCS file: /cvs/src/usr.bin/vi/cl/cl_funcs.c,v retrieving revision 1.17 diff -u -r1.17 cl_funcs.c --- cl/cl_funcs.c 12 Nov 2014 16:29:04 -0000 1.17 +++ cl/cl_funcs.c 20 Nov 2014 20:36:40 -0000 @@ -466,14 +466,12 @@ int cl_rename(SCR *sp, char *name, int on) { - GS *gp; CL_PRIVATE *clp; char *ttype; - gp = sp->gp; clp = CLP(sp); - ttype = OG_STR(gp, GO_TERM); + ttype = OG_STR(sp->gp, GO_TERM); /* * XXX Index: cl/cl_main.c =================================================================== RCS file: /cvs/src/usr.bin/vi/cl/cl_main.c,v retrieving revision 1.25 diff -u -r1.25 cl_main.c --- cl/cl_main.c 19 Nov 2014 03:42:40 -0000 1.25 +++ cl/cl_main.c 20 Nov 2014 20:36:40 -0000 @@ -33,7 +33,6 @@ GS *__global_list; /* GLOBAL: List of screens. */ sigset_t __sigblockset; /* GLOBAL: Blocked signals. */ -static void cl_func_std(GS *); static CL_PRIVATE *cl_init(GS *); static GS *gs_init(char *); static void perr(char *, char *); @@ -202,9 +201,6 @@ (void)close(fd); } - /* Initialize the list of curses functions. */ - cl_func_std(gp); - return (clp); } @@ -351,36 +347,6 @@ (void)sigaction(SIGINT, NULL, &clp->oact[INDX_INT]); (void)sigaction(SIGTERM, NULL, &clp->oact[INDX_TERM]); (void)sigaction(SIGWINCH, NULL, &clp->oact[INDX_WINCH]); -} - -/* - * cl_func_std -- - * Initialize the standard curses functions. - */ -static void -cl_func_std(GS *gp) -{ - gp->scr_addstr = cl_addstr; - gp->scr_attr = cl_attr; - gp->scr_baud = cl_baud; - gp->scr_bell = cl_bell; - gp->scr_busy = NULL; - gp->scr_clrtoeol = cl_clrtoeol; - gp->scr_cursor = cl_cursor; - gp->scr_deleteln = cl_deleteln; - gp->scr_event = cl_event; - gp->scr_ex_adjust = cl_ex_adjust; - gp->scr_fmap = cl_fmap; - gp->scr_insertln = cl_insertln; - gp->scr_keyval = cl_keyval; - gp->scr_move = cl_move; - gp->scr_msg = NULL; - gp->scr_optchange = cl_optchange; - gp->scr_refresh = cl_refresh; - gp->scr_rename = cl_rename; - gp->scr_screen = cl_screen; - gp->scr_suspend = cl_suspend; - gp->scr_usage = cl_usage; } /* Index: cl/cl_read.c =================================================================== RCS file: /cvs/src/usr.bin/vi/cl/cl_read.c,v retrieving revision 1.19 diff -u -r1.19 cl_read.c --- cl/cl_read.c 12 Nov 2014 04:28:41 -0000 1.19 +++ cl/cl_read.c 20 Nov 2014 20:36:40 -0000 @@ -128,12 +128,10 @@ { struct termios term1, term2; CL_PRIVATE *clp; - GS *gp; struct pollfd pfd[1]; input_t rval; int nr, term_reset, timeout; - gp = sp->gp; clp = CLP(sp); term_reset = 0; @@ -205,7 +203,7 @@ * It's ugly that we wait on scripting file descriptors here, but it's * the only way to keep from locking out scripting windows. */ - if (F_ISSET(gp, G_SCRWIN)) { + if (F_ISSET(sp->gp, G_SCRWIN)) { if (sscr_check_input(sp)) goto err; } Index: common/gs.h =================================================================== RCS file: /cvs/src/usr.bin/vi/common/gs.h,v retrieving revision 1.13 diff -u -r1.13 gs.h --- common/gs.h 20 Nov 2014 08:50:53 -0000 1.13 +++ common/gs.h 20 Nov 2014 20:36:40 -0000 @@ -40,13 +40,13 @@ u_int16_t flags; }; -/* Action arguments to scr_exadjust(). */ +/* Action arguments to cl_ex_adjust(). */ typedef enum { EX_TERM_CE, EX_TERM_SCROLL } exadj_t; -/* Screen attribute arguments to scr_attr(). */ +/* Screen attribute arguments to cl_attr(). */ typedef enum { SA_ALTERNATE, SA_INVERSE } scr_attr_t; -/* Key type arguments to scr_keyval(). */ +/* Key type arguments to cl_keyval(). */ typedef enum { KEY_VEOF, KEY_VERASE, KEY_VKILL, KEY_VWERASE } scr_keyval_t; /* @@ -64,8 +64,6 @@ SCR *ccl_sp; /* Colon command-line screen. */ void *cl_private; /* Curses support private area. */ - void *ip_private; /* IP support private area. */ - void *tk_private; /* Tk/Tcl support private area. */ /* File references. */ TAILQ_HEAD(_frefh, _fref) frefq; @@ -147,50 +145,6 @@ #define G_SRESTART 0x0080 /* Screen restarted. */ #define G_TMP_INUSE 0x0100 /* Temporary buffer in use. */ u_int32_t flags; - - /* Screen interface functions. */ - /* Add a string to the screen. */ - int (*scr_addstr)(SCR *, const char *, size_t); - /* Toggle a screen attribute. */ - int (*scr_attr)(SCR *, scr_attr_t, int); - /* Terminal baud rate. */ - int (*scr_baud)(SCR *, u_long *); - /* Beep/bell/flash the terminal. */ - int (*scr_bell)(SCR *); - /* Display a busy message. */ - void (*scr_busy)(SCR *, const char *, busy_t); - /* Clear to the end of the line. */ - int (*scr_clrtoeol)(SCR *); - /* Return the cursor location. */ - int (*scr_cursor)(SCR *, size_t *, size_t *); - /* Delete a line. */ - int (*scr_deleteln)(SCR *); - /* Get a keyboard event. */ - int (*scr_event)(SCR *, EVENT *, u_int32_t, int); - /* Ex: screen adjustment routine. */ - int (*scr_ex_adjust)(SCR *, exadj_t); - int (*scr_fmap) /* Set a function key. */ -(SCR *, seq_t, CHAR_T *, size_t, CHAR_T *, size_t); - /* Get terminal key value. */ - int (*scr_keyval)(SCR *, scr_keyval_t, CHAR_T *, int *); - /* Insert a line. */ - int (*scr_insertln)(SCR *); - /* Handle an option change. */ - int (*scr_optchange)(SCR *, int, char *, u_long *); - /* Move the cursor. */ - int (*scr_move)(SCR *, size_t, size_t); - /* Message or ex output. */ - void (*scr_msg)(SCR *, mtype_t, char *, size_t); - /* Refresh the screen. */ - int (*scr_refresh)(SCR *, int); - /* Rename the file. */ - int (*scr_rename)(SCR *, char *, int); - /* Set the screen type. */ - int (*scr_screen)(SCR *, u_int32_t); - /* Suspend the editor. */ - int (*scr_suspend)(SCR *, int *); - /* Print usage message. */ - void (*scr_usage)(void); }; /* Index: common/key.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/key.c,v retrieving revision 1.13 diff -u -r1.13 key.c --- common/key.c 12 Nov 2014 04:28:41 -0000 1.13 +++ common/key.c 20 Nov 2014 21:00:56 -0000 @@ -20,12 +20,15 @@ #include <errno.h> #include <limits.h> #include <locale.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "common.h" +#include "../cl/cl.h" #include "../vi/vi.h" static int v_event_append(SCR *, EVENT *); @@ -160,7 +163,7 @@ int dne; /* Get the key's value from the screen. */ - if (sp->gp->scr_keyval(sp, name, &ch, &dne)) + if (cl_keyval(sp, name, &ch, &dne)) return; if (dne) return; @@ -529,7 +532,7 @@ */ if (F_ISSET(gp, G_SCRWIN) && sscr_input(sp)) return (1); -loop: if (gp->scr_event(sp, argp, +loop: if (cl_event(sp, argp, LF_ISSET(EC_INTERRUPT | EC_QUOTED | EC_RAW), timeout)) return (1); switch (argp->e_event) { @@ -670,7 +673,7 @@ * get anywhere useful. */ if ((++remap_cnt == 1 || remap_cnt % 10 == 0) && - (gp->scr_event(sp, &ev, + (cl_event(sp, &ev, EC_INTERRUPT, 0) || ev.e_event == E_INTERRUPT)) { F_SET(sp->gp, G_INTERRUPTED); argp->e_event = E_INTERRUPT; Index: common/main.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/main.c,v retrieving revision 1.26 diff -u -r1.26 main.c --- common/main.c 20 Nov 2014 08:50:53 -0000 1.26 +++ common/main.c 20 Nov 2014 20:36:41 -0000 @@ -21,12 +21,15 @@ #include <fcntl.h> #include <limits.h> #include <paths.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "common.h" +#include "../cl/cl.h" #include "../vi/vi.h" #ifdef DEBUG @@ -67,13 +70,6 @@ #endif }; - /* Initialize the busy routine, if not defined by the screen. */ - if (gp->scr_busy == NULL) - gp->scr_busy = vs_busy; - /* Initialize the message routine, if not defined by the screen. */ - if (gp->scr_msg == NULL) - gp->scr_msg = vs_msg; - /* Common global structure initialization. */ TAILQ_INIT(&gp->dq); TAILQ_INIT(&gp->hq); @@ -212,7 +208,7 @@ break; case '?': default: - (void)gp->scr_usage(); + cl_usage(); return (1); } argc -= optind; @@ -409,7 +405,7 @@ (ev.e_event == E_CHARACTER && (ev.e_value == K_CR || ev.e_value == K_NL))) break; - (void)gp->scr_bell(sp); + (void)cl_bell(sp); } } Index: common/msg.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/msg.c,v retrieving revision 1.21 diff -u -r1.21 msg.c --- common/msg.c 12 Nov 2014 16:29:04 -0000 1.21 +++ common/msg.c 20 Nov 2014 20:36:41 -0000 @@ -175,7 +175,7 @@ if (sp != NULL) (void)ex_fflush(sp); if (gp != NULL) - gp->scr_msg(sp, mt, bp, mlen); + vs_msg(sp, mt, bp, mlen); else (void)fprintf(stderr, "%.*s", (int)mlen, bp); @@ -323,7 +323,7 @@ ++tlen; (void)ex_fflush(sp); - sp->gp->scr_msg(sp, M_INFO, bp, tlen); + vs_msg(sp, M_INFO, bp, tlen); FREE_SPACE(sp, bp, blen); alloc_err: @@ -490,7 +490,7 @@ /* Flush any waiting ex messages. */ (void)ex_fflush(sp); - sp->gp->scr_msg(sp, M_INFO, s, len); + vs_msg(sp, M_INFO, s, len); FREE_SPACE(sp, bp, blen); alloc_err: Index: common/options.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/options.c,v retrieving revision 1.18 diff -u -r1.18 options.c --- common/options.c 14 Nov 2014 20:27:03 -0000 1.18 +++ common/options.c 20 Nov 2014 20:36:41 -0000 @@ -21,12 +21,15 @@ #include <errno.h> #include <limits.h> #include <paths.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "common.h" +#include "../cl/cl.h" #include "../vi/vi.h" #include "pathnames.h" @@ -387,7 +390,7 @@ * Note, the windows option code will correct any too-large value * or when the O_LINES value is 1. */ - if (sp->gp->scr_baud(sp, &v)) + if (cl_baud(sp, &v)) return (1); if (v <= 600) v = 8; @@ -577,7 +580,7 @@ op->func(sp, spo, NULL, &turnoff)) || ex_optchange(sp, offset, NULL, &turnoff) || v_optchange(sp, offset, NULL, &turnoff) || - sp->gp->scr_optchange(sp, offset, NULL, &turnoff)) { + cl_optchange(sp, offset, NULL, &turnoff)) { rval = 1; break; } @@ -672,7 +675,7 @@ op->func(sp, spo, sep, &value)) || ex_optchange(sp, offset, sep, &value) || v_optchange(sp, offset, sep, &value) || - sp->gp->scr_optchange(sp, offset, sep, &value)) { + cl_optchange(sp, offset, sep, &value)) { rval = 1; break; } @@ -719,7 +722,7 @@ op->func(sp, spo, sep, NULL)) || ex_optchange(sp, offset, sep, NULL) || v_optchange(sp, offset, sep, NULL) || - sp->gp->scr_optchange(sp, offset, sep, NULL)) { + cl_optchange(sp, offset, sep, NULL)) { rval = 1; break; } Index: common/options_f.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/options_f.c,v retrieving revision 1.9 diff -u -r1.9 options_f.c --- common/options_f.c 12 Nov 2014 04:28:41 -0000 1.9 +++ common/options_f.c 20 Nov 2014 20:36:41 -0000 @@ -19,12 +19,15 @@ #include <ctype.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "common.h" +#include "../cl/cl.h" /* * PUBLIC: int f_altwerase(SCR *, OPTION *, char *, u_long *); @@ -246,7 +249,7 @@ u_long v; /* Historical behavior for w300 was < 1200. */ - if (sp->gp->scr_baud(sp, &v)) + if (cl_baud(sp, &v)) return (1); if (v >= 1200) return (0); @@ -263,7 +266,7 @@ u_long v; /* Historical behavior for w1200 was == 1200. */ - if (sp->gp->scr_baud(sp, &v)) + if (cl_baud(sp, &v)) return (1); if (v < 1200 || v > 4800) return (0); @@ -280,7 +283,7 @@ u_long v; /* Historical behavior for w9600 was > 1200. */ - if (sp->gp->scr_baud(sp, &v)) + if (cl_baud(sp, &v)) return (1); if (v <= 4800) return (0); Index: common/recover.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/recover.c,v retrieving revision 1.19 diff -u -r1.19 recover.c --- common/recover.c 14 Nov 2014 20:27:03 -0000 1.19 +++ common/recover.c 20 Nov 2014 20:36:41 -0000 @@ -36,6 +36,7 @@ #include <unistd.h> #include "common.h" +#include "../vi/vi.h" /* * Recovery code. @@ -208,15 +209,14 @@ goto err; /* Turn on a busy message, and sync it to backing store. */ - sp->gp->scr_busy(sp, - "057|Copying file for recovery...", BUSY_ON); + vs_busy(sp, "057|Copying file for recovery...", BUSY_ON); if (ep->db->sync(ep->db, R_RECNOSYNC)) { msgq_str(sp, M_SYSERR, ep->rcv_path, "058|Preservation failed: %s"); - sp->gp->scr_busy(sp, NULL, BUSY_OFF); + vs_busy(sp, NULL, BUSY_OFF); goto err; } - sp->gp->scr_busy(sp, NULL, BUSY_OFF); + vs_busy(sp, NULL, BUSY_OFF); } /* Turn off the owner execute bit. */ @@ -292,15 +292,14 @@ (void)snprintf(buf, sizeof(buf), "%s/vi.XXXXXXXXXX", dp); if ((fd = rcv_mktemp(sp, buf, dp, S_IRUSR | S_IWUSR)) == -1) goto err; - sp->gp->scr_busy(sp, - "061|Copying file for recovery...", BUSY_ON); + vs_busy(sp, "061|Copying file for recovery...", BUSY_ON); if (rcv_copy(sp, fd, ep->rcv_path) || close(fd) || rcv_mailfile(sp, 1, buf)) { (void)unlink(buf); (void)close(fd); rval = 1; } - sp->gp->scr_busy(sp, NULL, BUSY_OFF); + vs_busy(sp, NULL, BUSY_OFF); } if (0) { err: rval = 1; Index: common/search.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/search.c,v retrieving revision 1.10 diff -u -r1.10 search.c --- common/search.c 12 Nov 2014 04:28:41 -0000 1.10 +++ common/search.c 20 Nov 2014 20:36:41 -0000 @@ -18,12 +18,16 @@ #include <ctype.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "common.h" +#include "../cl/cl.h" +#include "../vi/vi.h" typedef enum { S_EMPTY, S_EOF, S_NOPREV, S_NOTFOUND, S_SOF, S_WRAP } smsg_t; @@ -236,7 +240,7 @@ if (LF_ISSET(SEARCH_MSG)) re_error(sp, eval, &sp->re_c); else - (void)sp->gp->scr_bell(sp); + (void)cl_bell(sp); break; } @@ -368,7 +372,7 @@ if (LF_ISSET(SEARCH_MSG)) re_error(sp, eval, &sp->re_c); else - (void)sp->gp->scr_bell(sp); + (void)cl_bell(sp); break; } @@ -404,7 +408,7 @@ if (LF_ISSET(SEARCH_MSG)) re_error(sp, eval, &sp->re_c); else - (void)sp->gp->scr_bell(sp); + (void)cl_bell(sp); goto err; } if (coff && match[0].rm_so >= coff) @@ -468,5 +472,5 @@ void search_busy(SCR *sp, busy_t btype) { - sp->gp->scr_busy(sp, "078|Searching...", btype); + vs_busy(sp, "078|Searching...", btype); } Index: common/seq.c =================================================================== RCS file: /cvs/src/usr.bin/vi/common/seq.c,v retrieving revision 1.9 diff -u -r1.9 seq.c --- common/seq.c 12 Nov 2014 04:28:41 -0000 1.9 +++ common/seq.c 20 Nov 2014 20:36:41 -0000 @@ -270,13 +270,11 @@ seq_dump(SCR *sp, seq_t stype, int isname) { CHAR_T *p; - GS *gp; SEQ *qp; int cnt, len, olen; cnt = 0; - gp = sp->gp; - LIST_FOREACH(qp, &gp->seqq, q) { + LIST_FOREACH(qp, &sp->gp->seqq, q) { if (stype != qp->stype || F_ISSET(qp, SEQ_FUNCMAP)) continue; ++cnt; Index: ex/ex.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex.c,v retrieving revision 1.19 diff -u -r1.19 ex.c --- ex/ex.c 12 Nov 2014 04:28:41 -0000 1.19 +++ ex/ex.c 20 Nov 2014 20:36:41 -0000 @@ -21,12 +21,15 @@ #include <errno.h> #include <fcntl.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" #include "../vi/vi.h" #if defined(DEBUG) && defined(COMLOG) @@ -63,7 +66,7 @@ /* Flush any saved messages. */ while ((mp = LIST_FIRST(&gp->msgq)) != NULL) { - gp->scr_msg(sp, mp->mtype, mp->buf, mp->len); + vs_msg(sp, mp->mtype, mp->buf, mp->len); LIST_REMOVE(mp, q); free(mp->buf); free(mp); @@ -1354,7 +1357,7 @@ if (sp->ep != NULL && F_ISSET(sp, SC_EX) && !F_ISSET(gp, G_SCRIPTED) && (F_ISSET(ecp, E_USELASTCMD) || ecp->cmd == &cmds[C_SCROLL])) - gp->scr_ex_adjust(sp, EX_TERM_SCROLL); + cl_ex_adjust(sp, EX_TERM_SCROLL); F_CLR(ecp, E_NRSEP); } Index: ex/ex_append.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_append.c,v retrieving revision 1.10 diff -u -r1.10 ex_append.c --- ex/ex_append.c 12 Nov 2014 04:28:41 -0000 1.10 +++ ex/ex_append.c 20 Nov 2014 20:36:41 -0000 @@ -16,11 +16,14 @@ #include <bitstring.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" enum which {APPEND, CHANGE, INSERT}; @@ -201,7 +204,7 @@ * be possible. */ if (F_ISSET(sp, SC_VI)) { - if (gp->scr_screen(sp, SC_EX)) { + if (cl_screen(sp, SC_EX)) { ex_emsg(sp, cmdp->cmd->name, EXM_NOCANON); return (1); } Index: ex/ex_file.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_file.c,v retrieving revision 1.7 diff -u -r1.7 ex_file.c --- ex/ex_file.c 12 Nov 2014 04:28:41 -0000 1.7 +++ ex/ex_file.c 20 Nov 2014 20:36:41 -0000 @@ -17,11 +17,14 @@ #include <bitstring.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" /* * ex_file -- :f[ile] [name] @@ -66,7 +69,7 @@ F_SET(frp, FR_NAMECHANGE); /* Notify the screen. */ - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); break; default: abort(); Index: ex/ex_map.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_map.c,v retrieving revision 1.6 diff -u -r1.6 ex_map.c --- ex/ex_map.c 12 Nov 2014 04:28:41 -0000 1.6 +++ ex/ex_map.c 20 Nov 2014 20:36:41 -0000 @@ -17,11 +17,14 @@ #include <bitstring.h> #include <ctype.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" /* * ex_map -- :map[!] [input] [replacement] @@ -76,8 +79,7 @@ cmdp->argv[1]->bp, cmdp->argv[1]->len, stype, SEQ_FUNCMAP | SEQ_USERDEF)) return (1); - return (sp->gp->scr_fmap == NULL ? 0 : - sp->gp->scr_fmap(sp, stype, input, cmdp->argv[0]->len, + return (cl_fmap(sp, stype, input, cmdp->argv[0]->len, cmdp->argv[1]->bp, cmdp->argv[1]->len)); } Index: ex/ex_print.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_print.c,v retrieving revision 1.10 diff -u -r1.10 ex_print.c --- ex/ex_print.c 12 Nov 2014 04:28:41 -0000 1.10 +++ ex/ex_print.c 20 Nov 2014 20:36:41 -0000 @@ -22,6 +22,7 @@ #include <string.h> #include "../common/common.h" +#include "../vi/vi.h" static int ex_prchars(SCR *, const char *, size_t *, size_t, u_int, int); @@ -303,7 +304,7 @@ exp = EXP(sp); if (exp->obp_len != 0) { - sp->gp->scr_msg(sp, M_NONE, exp->obp, exp->obp_len); + vs_msg(sp, M_NONE, exp->obp, exp->obp_len); exp->obp_len = 0; } return (0); Index: ex/ex_read.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_read.c,v retrieving revision 1.10 diff -u -r1.10 ex_read.c --- ex/ex_read.c 12 Nov 2014 04:28:41 -0000 1.10 +++ ex/ex_read.c 20 Nov 2014 20:36:41 -0000 @@ -20,11 +20,14 @@ #include <ctype.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" #include "../vi/vi.h" /* @@ -154,7 +157,7 @@ * the screen on a normal read. */ if (F_ISSET(sp, SC_VI)) { - if (gp->scr_screen(sp, SC_EX)) { + if (cl_screen(sp, SC_EX)) { ex_emsg(sp, cmdp->cmd->name, EXM_NOCANON_F); return (1); } @@ -227,7 +230,7 @@ F_SET(sp->frp, FR_NAMECHANGE | FR_EXNAMED); /* Notify the screen. */ - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); } else set_alt_name(sp, name); break; @@ -318,7 +321,7 @@ if (INTERRUPTED(sp)) break; if (!silent) { - gp->scr_busy(sp, p, + vs_busy(sp, p, p == NULL ? BUSY_UPDATE : BUSY_ON); p = NULL; } @@ -351,6 +354,6 @@ } if (!silent) - gp->scr_busy(sp, NULL, BUSY_OFF); + vs_busy(sp, NULL, BUSY_OFF); return (rval); } Index: ex/ex_shell.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_shell.c,v retrieving revision 1.13 diff -u -r1.13 ex_shell.c --- ex/ex_shell.c 12 Nov 2014 04:28:41 -0000 1.13 +++ ex/ex_shell.c 20 Nov 2014 20:36:41 -0000 @@ -22,9 +22,11 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" /* * ex_shell -- :sh[ell] @@ -50,13 +52,13 @@ (void)snprintf(buf, sizeof(buf), "%s -i", O_STR(sp, O_SHELL)); /* Restore the window name. */ - (void)sp->gp->scr_rename(sp, NULL, 0); + (void)cl_rename(sp, NULL, 0); /* If we're still in a vi screen, move out explicitly. */ rval = ex_exec_proc(sp, cmdp, buf, NULL, !F_ISSET(sp, SC_SCR_EXWROTE)); /* Set the window name. */ - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); /* * !!! @@ -90,11 +92,11 @@ /* Enter ex mode. */ if (F_ISSET(sp, SC_VI)) { - if (gp->scr_screen(sp, SC_EX)) { + if (cl_screen(sp, SC_EX)) { ex_emsg(sp, cmdp->cmd->name, EXM_NOCANON); return (1); } - (void)gp->scr_attr(sp, SA_ALTERNATE, 0); + (void)cl_attr(sp, SA_ALTERNATE, 0); F_SET(sp, SC_SCR_EX | SC_SCR_EXWROTE); } Index: ex/ex_stop.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_stop.c,v retrieving revision 1.6 diff -u -r1.6 ex_stop.c --- ex/ex_stop.c 12 Nov 2014 04:28:41 -0000 1.6 +++ ex/ex_stop.c 20 Nov 2014 20:36:41 -0000 @@ -17,11 +17,14 @@ #include <bitstring.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" /* * ex_stop -- :stop[!] @@ -39,7 +42,7 @@ if (!FL_ISSET(cmdp->iflags, E_C_FORCE) && file_aw(sp, FS_ALL)) return (1); - if (sp->gp->scr_suspend(sp, &allowed)) + if (cl_suspend(sp, &allowed)) return (1); if (!allowed) ex_emsg(sp, NULL, EXM_NOSUSPEND); Index: ex/ex_txt.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_txt.c,v retrieving revision 1.13 diff -u -r1.13 ex_txt.c --- ex/ex_txt.c 12 Nov 2014 04:28:41 -0000 1.13 +++ ex/ex_txt.c 20 Nov 2014 20:36:41 -0000 @@ -17,11 +17,14 @@ #include <bitstring.h> #include <ctype.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" #include "../vi/vi.h" /* @@ -297,7 +300,7 @@ continue; carat_st = C_NOTSET; -leftmargin: (void)gp->scr_ex_adjust(sp, EX_TERM_CE); +leftmargin: (void)cl_ex_adjust(sp, EX_TERM_CE); tp->ai = tp->len = 0; break; case C_NOTSET: /* ^D */ @@ -312,7 +315,7 @@ } /* Clear and redisplay the line. */ - (void)gp->scr_ex_adjust(sp, EX_TERM_CE); + (void)cl_ex_adjust(sp, EX_TERM_CE); txt_prompt(sp, tp, prompt, flags); break; default: Index: ex/ex_util.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_util.c,v retrieving revision 1.8 diff -u -r1.8 ex_util.c --- ex/ex_util.c 12 Nov 2014 04:28:41 -0000 1.8 +++ ex/ex_util.c 20 Nov 2014 20:36:41 -0000 @@ -18,12 +18,15 @@ #include <bitstring.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" /* * ex_cinit -- @@ -145,9 +148,9 @@ gp = sp->gp; - if (gp->scr_screen(sp, SC_EX)) + if (cl_screen(sp, SC_EX)) return (1); - (void)gp->scr_attr(sp, SA_ALTERNATE, 0); + (void)cl_attr(sp, SA_ALTERNATE, 0); sp->rows = O_VAL(sp, O_LINES); sp->cols = O_VAL(sp, O_COLUMNS); Index: ex/ex_write.c =================================================================== RCS file: /cvs/src/usr.bin/vi/ex/ex_write.c,v retrieving revision 1.12 diff -u -r1.12 ex_write.c --- ex/ex_write.c 12 Nov 2014 04:28:41 -0000 1.12 +++ ex/ex_write.c 20 Nov 2014 20:36:41 -0000 @@ -20,12 +20,16 @@ #include <errno.h> #include <fcntl.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" +#include "../vi/vi.h" enum which {WN, WQ, WRITE, XIT}; static int exwr(SCR *, EXCMD *, enum which); @@ -244,7 +248,7 @@ F_SET(sp->frp, FR_NAMECHANGE | FR_EXNAMED); /* Notify the screen. */ - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); } else set_alt_name(sp, name); break; @@ -309,7 +313,7 @@ if (INTERRUPTED(sp)) break; if (!silent) { - gp->scr_busy(sp, msg, msg == NULL ? + vs_busy(sp, msg, msg == NULL ? BUSY_UPDATE : BUSY_ON); msg = NULL; } @@ -350,7 +354,7 @@ } if (!silent) - gp->scr_busy(sp, NULL, BUSY_OFF); + vs_busy(sp, NULL, BUSY_OFF); /* Report the possibly partial transfer. */ if (nlno != NULL) { Index: vi/v_ex.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/v_ex.c,v retrieving revision 1.12 diff -u -r1.12 v_ex.c --- vi/v_ex.c 12 Nov 2014 04:28:41 -0000 1.12 +++ vi/v_ex.c 20 Nov 2014 20:36:41 -0000 @@ -17,12 +17,15 @@ #include <bitstring.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" static int v_ecl(SCR *); @@ -58,17 +61,13 @@ int v_exmode(SCR *sp, VICMD *vp) { - GS *gp; - - gp = sp->gp; - /* Try and switch screens -- the screen may not permit it. */ - if (gp->scr_screen(sp, SC_EX)) { + if (cl_screen(sp, SC_EX)) { msgq(sp, M_ERR, "207|The Q command requires the ex terminal interface"); return (1); } - (void)gp->scr_attr(sp, SA_ALTERNATE, 0); + (void)cl_attr(sp, SA_ALTERNATE, 0); /* Save the current cursor position. */ sp->frp->lno = sp->lno; @@ -356,12 +355,9 @@ int v_ex(SCR *sp, VICMD *vp) { - GS *gp; TEXT *tp; int do_cedit, do_resolution, ifcontinue; - gp = sp->gp; - /* * !!! * If we put out more than a single line of messages, or ex trashes @@ -377,7 +373,7 @@ * There may already be an ex command waiting to run. If * so, we continue with it. */ - if (!EXCMD_RUNNING(gp)) { + if (!EXCMD_RUNNING(sp->gp)) { /* Get a command. */ if (v_tcmd(sp, vp, ':', TXT_BS | TXT_CEDIT | TXT_FILEC | TXT_PROMPT)) Index: vi/v_redraw.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/v_redraw.c,v retrieving revision 1.6 diff -u -r1.6 v_redraw.c --- vi/v_redraw.c 12 Nov 2014 04:28:41 -0000 1.6 +++ vi/v_redraw.c 20 Nov 2014 20:36:41 -0000 @@ -17,9 +17,12 @@ #include <bitstring.h> #include <limits.h> +#include <signal.h> #include <stdio.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" /* @@ -31,5 +34,5 @@ int v_redraw(SCR *sp, VICMD *vp) { - return (sp->gp->scr_refresh(sp, 1)); + return (cl_refresh(sp, 1)); } Index: vi/v_txt.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/v_txt.c,v retrieving revision 1.27 diff -u -r1.27 v_txt.c --- vi/v_txt.c 12 Nov 2014 04:28:41 -0000 1.27 +++ vi/v_txt.c 20 Nov 2014 20:36:41 -0000 @@ -20,12 +20,15 @@ #include <ctype.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" static int txt_abbrev(SCR *, TEXT *, CHAR_T *, int, int *, int *); @@ -182,8 +185,8 @@ */ if (IS_SMALL(sp)) { for (cnt = sp->t_rows; cnt <= sp->t_maxrows; ++cnt) { - (void)sp->gp->scr_move(sp, cnt, 0); - (void)sp->gp->scr_clrtoeol(sp); + (void)cl_move(sp, cnt, 0); + (void)cl_clrtoeol(sp); } TMAP = HMAP + (sp->t_rows - 1); } else @@ -2044,7 +2047,7 @@ switch (argc) { case 0: /* No matches. */ if (!trydir) - (void)sp->gp->scr_bell(sp); + (void)cl_bell(sp); return (0); case 1: /* One match. */ /* If something changed, do the exchange. */ @@ -2061,7 +2064,7 @@ /* If nothing changed, period, ring the bell. */ if (!trydir) - (void)sp->gp->scr_bell(sp); + (void)cl_bell(sp); return (0); default: /* Multiple matches. */ *redrawp = 1; @@ -2627,7 +2630,7 @@ if (lno != TMAP[0].lno) { if (vs_line(sp, &TMAP[0], NULL, NULL)) return (1); - (void)sp->gp->scr_refresh(sp, 0); + (void)cl_refresh(sp, 0); } return (0); } Index: vi/vi.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vi.c,v retrieving revision 1.15 diff -u -r1.15 vi.c --- vi/vi.c 12 Nov 2014 04:28:41 -0000 1.15 +++ vi/vi.c 20 Nov 2014 20:36:41 -0000 @@ -19,12 +19,15 @@ #include <ctype.h> #include <errno.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" typedef enum { @@ -85,7 +88,7 @@ return (1); /* Set the focus. */ - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); for (vip = VIP(sp), rval = 0;;) { /* Resolve messages. */ @@ -262,7 +265,7 @@ /* Switch screens, change focus. */ sp = next; vip = VIP(sp); - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); /* Don't trust the cursor. */ F_SET(vip, VIP_CUR_INVALID); @@ -382,7 +385,7 @@ /* Switch screens, change focus. */ sp = sp->nextdisp; vip = VIP(sp); - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); /* Don't trust the cursor. */ F_SET(vip, VIP_CUR_INVALID); @@ -395,7 +398,7 @@ /* If the last command switched files, change focus. */ if (F_ISSET(sp, SC_FSWITCH)) { F_CLR(sp, SC_FSWITCH); - (void)sp->gp->scr_rename(sp, sp->frp->name, 1); + (void)cl_rename(sp, sp->frp->name, 1); } /* If leaving vi, return to the main editor loop. */ @@ -698,7 +701,7 @@ case ISPARTIAL: break; case NOTPARTIAL: - (void)sp->gp->scr_bell(sp); + (void)cl_bell(sp); break; } return (GC_ERR); @@ -922,16 +925,14 @@ static int v_init(SCR *sp) { - GS *gp; VI_PRIVATE *vip; - gp = sp->gp; vip = VIP(sp); /* Switch into vi. */ - if (gp->scr_screen(sp, SC_VI)) + if (cl_screen(sp, SC_VI)) return (1); - (void)gp->scr_attr(sp, SA_ALTERNATE, 1); + (void)cl_attr(sp, SA_ALTERNATE, 1); F_CLR(sp, SC_EX | SC_SCR_EX); F_SET(sp, SC_VI); @@ -1189,7 +1190,7 @@ * generated in a row. (Just figured you might want * to know that.) */ - (void)sp->gp->scr_bell(sp); + (void)cl_bell(sp); return (GC_INTERRUPT); case E_REPAINT: if (vs_repaint(sp, evp)) Index: vi/vs_line.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vs_line.c,v retrieving revision 1.14 diff -u -r1.14 vs_line.c --- vi/vs_line.c 12 Nov 2014 04:28:41 -0000 1.14 +++ vi/vs_line.c 20 Nov 2014 20:36:41 -0000 @@ -17,10 +17,13 @@ #include <bitstring.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <string.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" #ifdef VISIBLE_TAB_CHARS @@ -39,7 +42,6 @@ vs_line(SCR *sp, SMAP *smp, size_t *yp, size_t *xp) { CHAR_T *kp; - GS *gp; SMAP *tsmp; size_t chlen = 0, cno_cnt, cols_per_screen, len, nlen; size_t offset_in_char, offset_in_line, oldx, oldy; @@ -82,9 +84,8 @@ * the real contents of the screen are. Because of this, we have to * return to whereever we started from. */ - gp = sp->gp; - (void)gp->scr_cursor(sp, &oldy, &oldx); - (void)gp->scr_move(sp, smp - HMAP, 0); + (void)cl_cursor(sp, &oldy, &oldx); + (void)cl_move(sp, smp - HMAP, 0); /* Get the line. */ dne = db_get(sp, smp->lno, 0, &p, &len); @@ -138,7 +139,7 @@ O_NUMBER_FMT, (ulong)smp->lno); if (nlen >= sizeof(cbuf)) nlen = sizeof(cbuf) - 1; - (void)gp->scr_addstr(sp, cbuf, nlen); + (void)cl_addstr(sp, cbuf, nlen); } } } @@ -181,13 +182,13 @@ } else if (list_dollar) { ch = '$'; -empty: (void)gp->scr_addstr(sp, +empty: (void)cl_addstr(sp, KEY_NAME(sp, ch), KEY_LEN(sp, ch)); } } - (void)gp->scr_clrtoeol(sp); - (void)gp->scr_move(sp, oldy, oldx); + (void)cl_clrtoeol(sp); + (void)cl_move(sp, oldy, oldx); return (0); } @@ -397,9 +398,9 @@ if (is_cached) continue; -#define FLUSH(gp, sp, cbp, cbuf) do { \ +#define FLUSH(sp, cbp, cbuf) do { \ *(cbp) = '\0'; \ - (void)(gp)->scr_addstr((sp), (cbuf), (cbp) - (cbuf)); \ + (void)cl_addstr((sp), (cbuf), (cbp) - (cbuf)); \ (cbp) = (cbuf); \ } while (0) /* @@ -412,12 +413,12 @@ if (is_tab) while (chlen--) { if (cbp >= ecbp) - FLUSH(gp, sp, cbp, cbuf); + FLUSH(sp, cbp, cbuf); *cbp++ = TABCH; } else { if (cbp + chlen >= ecbp) - FLUSH(gp, sp, cbp, cbuf); + FLUSH(sp, cbp, cbuf); for (kp = KEY_NAME(sp, ch) + offset_in_char; chlen--;) *cbp++ = *kp++; } @@ -438,21 +439,21 @@ chlen = KEY_LEN(sp, '$'); if (cbp + chlen >= ecbp) - FLUSH(gp, sp, cbp, cbuf); + FLUSH(sp, cbp, cbuf); for (kp = KEY_NAME(sp, '$'); chlen--;) *cbp++ = *kp++; } /* If still didn't paint the whole line, clear the rest. */ if (scno < cols_per_screen) - (void)gp->scr_clrtoeol(sp); + (void)cl_clrtoeol(sp); } /* Flush any buffered characters. */ if (cbp > cbuf) - FLUSH(gp, sp, cbp, cbuf); + FLUSH(sp, cbp, cbuf); -ret1: (void)gp->scr_move(sp, oldy, oldx); +ret1: (void)cl_move(sp, oldy, oldx); return (0); } @@ -465,14 +466,11 @@ int vs_number(SCR *sp) { - GS *gp; SMAP *smp; size_t len, oldy, oldx; int exist; char nbuf[10]; - gp = sp->gp; - /* No reason to do anything if we're in input mode on the info line. */ if (F_ISSET(sp, SC_TINPUT_INFO)) return (0); @@ -488,7 +486,7 @@ */ exist = db_exist(sp, TMAP->lno + 1); - (void)gp->scr_cursor(sp, &oldy, &oldx); + (void)cl_cursor(sp, &oldy, &oldx); for (smp = HMAP; smp <= TMAP; ++smp) { /* Numbers are only displayed for the first screen line. */ if (O_ISSET(sp, O_LEFTRIGHT)) { @@ -505,12 +503,12 @@ if (smp->lno != 1 && !exist && !db_exist(sp, smp->lno)) break; - (void)gp->scr_move(sp, smp - HMAP, 0); + (void)cl_move(sp, smp - HMAP, 0); len = snprintf(nbuf, sizeof(nbuf), O_NUMBER_FMT, (ulong)smp->lno); if (len >= sizeof(nbuf)) len = sizeof(nbuf) - 1; - (void)gp->scr_addstr(sp, nbuf, len); + (void)cl_addstr(sp, nbuf, len); } - (void)gp->scr_move(sp, oldy, oldx); + (void)cl_move(sp, oldy, oldx); return (0); } Index: vi/vs_msg.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vs_msg.c,v retrieving revision 1.13 diff -u -r1.13 vs_msg.c --- vi/vs_msg.c 12 Nov 2014 04:28:41 -0000 1.13 +++ vi/vs_msg.c 20 Nov 2014 20:36:41 -0000 @@ -17,12 +17,15 @@ #include <bitstring.h> #include <ctype.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include <unistd.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" typedef enum { @@ -45,18 +48,14 @@ * vs_busy -- * Display, update or clear a busy message. * - * This routine is the default editor interface for vi busy messages. It - * implements a standard strategy of stealing lines from the bottom of the - * vi text screen. Screens using an alternate method of displaying busy - * messages, e.g. X11 clock icons, should set their scr_busy function to the - * correct function before calling the main editor routine. + * This routine is the editor interface for vi busy messages. It implements + * a standard strategy of stealing lines from the bottom of the vi text screen. * * PUBLIC: void vs_busy(SCR *, const char *, busy_t); */ void vs_busy(SCR *sp, const char *msg, busy_t btype) { - GS *gp; VI_PRIVATE *vip; static const char flagc[] = "|/-\\"; struct timeval tv; @@ -67,7 +66,6 @@ if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)) return; - gp = sp->gp; vip = VIP(sp); /* @@ -87,15 +85,15 @@ (void)gettimeofday(&vip->busy_tv, NULL); /* Save the current cursor. */ - (void)gp->scr_cursor(sp, &vip->busy_oldy, &vip->busy_oldx); + (void)cl_cursor(sp, &vip->busy_oldy, &vip->busy_oldx); /* Display the busy message. */ p = msg_cat(sp, msg, &len); - (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_addstr(sp, p, len); - (void)gp->scr_cursor(sp, ¬used, &vip->busy_fx); - (void)gp->scr_clrtoeol(sp); - (void)gp->scr_move(sp, LASTLINE(sp), vip->busy_fx); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_addstr(sp, p, len); + (void)cl_cursor(sp, ¬used, &vip->busy_fx); + (void)cl_clrtoeol(sp); + (void)cl_move(sp, LASTLINE(sp), vip->busy_fx); break; case BUSY_OFF: if (vip->busy_ref == 0) @@ -107,10 +105,10 @@ * Always return to the original position. */ if (vip->totalcount == 0 && vip->busy_ref == 0) { - (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_clrtoeol(sp); } - (void)gp->scr_move(sp, vip->busy_oldy, vip->busy_oldx); + (void)cl_move(sp, vip->busy_oldy, vip->busy_oldx); break; case BUSY_UPDATE: if (vip->totalcount != 0 || vip->busy_ref == 0) @@ -126,12 +124,12 @@ /* Display the update. */ if (vip->busy_ch == sizeof(flagc) - 1) vip->busy_ch = 0; - (void)gp->scr_move(sp, LASTLINE(sp), vip->busy_fx); - (void)gp->scr_addstr(sp, flagc + vip->busy_ch++, 1); - (void)gp->scr_move(sp, LASTLINE(sp), vip->busy_fx); + (void)cl_move(sp, LASTLINE(sp), vip->busy_fx); + (void)cl_addstr(sp, flagc + vip->busy_ch++, 1); + (void)cl_move(sp, LASTLINE(sp), vip->busy_fx); break; } - (void)gp->scr_refresh(sp, 0); + (void)cl_refresh(sp, 0); } /* @@ -143,8 +141,8 @@ void vs_home(SCR *sp) { - (void)sp->gp->scr_move(sp, LASTLINE(sp), 0); - (void)sp->gp->scr_refresh(sp, 0); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_refresh(sp, 0); } /* @@ -156,11 +154,8 @@ void vs_update(SCR *sp, const char *m1, const char *m2) { - GS *gp; size_t len, mlen, oldx, oldy; - gp = sp->gp; - /* * This routine displays a message on the bottom line of the screen, * without updating any of the command structures that would keep it @@ -179,11 +174,11 @@ * Save the cursor position, the substitute-with-confirmation code * will have already set it correctly. */ - (void)gp->scr_cursor(sp, &oldy, &oldx); + (void)cl_cursor(sp, &oldy, &oldx); /* Clear the bottom line. */ - (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_clrtoeol(sp); /* * XXX @@ -193,18 +188,18 @@ mlen = len = strlen(m1); if (len > sp->cols - 2) mlen = len = sp->cols - 2; - (void)gp->scr_addstr(sp, m1, mlen); + (void)cl_addstr(sp, m1, mlen); } else len = 0; if (m2 != NULL) { mlen = strlen(m2); if (len + mlen > sp->cols - 2) mlen = (sp->cols - 2) - len; - (void)gp->scr_addstr(sp, m2, mlen); + (void)cl_addstr(sp, m2, mlen); } - (void)gp->scr_move(sp, oldy, oldx); - (void)gp->scr_refresh(sp, 0); + (void)cl_move(sp, oldy, oldx); + (void)cl_refresh(sp, 0); } /* @@ -213,9 +208,7 @@ * * This routine is the default editor interface for all ex output, and all ex * and vi error/informational messages. It implements the standard strategy - * of stealing lines from the bottom of the vi text screen. Screens using an - * alternate method of displaying messages, e.g. dialog boxes, should set their - * scr_msg function to the correct function before calling the editor. + * of stealing lines from the bottom of the vi text screen. * * PUBLIC: void vs_msg(SCR *, mtype_t, char *, size_t); */ @@ -239,7 +232,7 @@ if (F_ISSET(sp, SC_TINPUT_INFO) || F_ISSET(gp, G_BELLSCHED)) { if (F_ISSET(sp, SC_SCR_VI)) { F_CLR(gp, G_BELLSCHED); - (void)gp->scr_bell(sp); + (void)cl_bell(sp); } else F_SET(gp, G_BELLSCHED); } @@ -270,7 +263,7 @@ if (F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)) { if (!F_ISSET(sp, SC_SCR_EX)) { if (F_ISSET(sp, SC_SCR_EXWROTE)) { - if (sp->gp->scr_screen(sp, SC_EX)) + if (cl_screen(sp, SC_EX)) return; } else if (ex_init(sp)) @@ -278,16 +271,16 @@ } if (mtype == M_ERR) - (void)gp->scr_attr(sp, SA_INVERSE, 1); + (void)cl_attr(sp, SA_INVERSE, 1); (void)printf("%.*s", (int)len, line); if (mtype == M_ERR) - (void)gp->scr_attr(sp, SA_INVERSE, 0); + (void)cl_attr(sp, SA_INVERSE, 0); (void)fflush(stdout); F_CLR(sp, SC_EX_WAIT_NO); if (!F_ISSET(sp, SC_SCR_EX)) - (void)sp->gp->scr_screen(sp, SC_VI); + (void)cl_screen(sp, SC_VI); return; } @@ -298,7 +291,7 @@ } /* Save the cursor position. */ - (void)gp->scr_cursor(sp, &oldy, &oldx); + (void)cl_cursor(sp, &oldy, &oldx); /* If it's an ex output message, just write it out. */ if (mtype == M_NONE) { @@ -376,8 +369,8 @@ break; } -ret: (void)gp->scr_move(sp, oldy, oldx); - (void)gp->scr_refresh(sp, 0); +ret: (void)cl_move(sp, oldy, oldx); + (void)cl_refresh(sp, 0); } /* @@ -388,14 +381,12 @@ vs_output(SCR *sp, mtype_t mtype, const char *line, int llen) { CHAR_T *kp; - GS *gp; VI_PRIVATE *vip; size_t chlen, notused; int ch, len, tlen; const char *p, *t; char *cbp, *ecbp, cbuf[128]; - gp = sp->gp; vip = VIP(sp); for (p = line; llen > 0;) { /* Get the next physical line. */ @@ -420,9 +411,9 @@ if (vip->lcontinue == 0) { if (!IS_ONELINE(sp)) { if (vip->totalcount == 1) { - (void)gp->scr_move(sp, + (void)cl_move(sp, LASTLINE(sp) - 1, 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_clrtoeol(sp); (void)vs_divider(sp); F_SET(vip, VIP_DIVIDER); ++vip->totalcount; @@ -438,23 +429,23 @@ if (vip->totalcount != 0) vs_scroll(sp, NULL, SCROLL_W_QUIT); - (void)gp->scr_move(sp, LASTLINE(sp), 0); + (void)cl_move(sp, LASTLINE(sp), 0); ++vip->totalcount; ++vip->linecount; if (INTERRUPTED(sp)) break; } else - (void)gp->scr_move(sp, LASTLINE(sp), vip->lcontinue); + (void)cl_move(sp, LASTLINE(sp), vip->lcontinue); /* Error messages are in inverse video. */ if (mtype == M_ERR) - (void)gp->scr_attr(sp, SA_INVERSE, 1); + (void)cl_attr(sp, SA_INVERSE, 1); /* Display the line, doing character translation. */ #define FLUSH { \ *cbp = '\0'; \ - (void)gp->scr_addstr(sp, cbuf, cbp - cbuf); \ + (void)cl_addstr(sp, cbuf, cbp - cbuf); \ cbp = cbuf; \ } ecbp = (cbp = cbuf) + sizeof(cbuf) - 1; @@ -478,10 +469,10 @@ if (cbp > cbuf) FLUSH; if (mtype == M_ERR) - (void)gp->scr_attr(sp, SA_INVERSE, 0); + (void)cl_attr(sp, SA_INVERSE, 0); /* Clear the rest of the line. */ - (void)gp->scr_clrtoeol(sp); + (void)cl_clrtoeol(sp); /* If we loop, it's a new line. */ vip->lcontinue = 0; @@ -497,7 +488,7 @@ /* Set up next continuation line. */ if (p == NULL) - gp->scr_cursor(sp, ¬used, &vip->lcontinue); + cl_cursor(sp, ¬used, &vip->lcontinue); } /* @@ -513,11 +504,9 @@ vs_ex_resolve(SCR *sp, int *continuep) { EVENT ev; - GS *gp; VI_PRIVATE *vip; sw_t wtype; - gp = sp->gp; vip = VIP(sp); *continuep = 0; @@ -548,7 +537,7 @@ * commands. That seems right to me (well, at least not wrong). */ if (F_ISSET(sp, SC_SCR_EXWROTE)) { - if (sp->gp->scr_screen(sp, SC_VI)) + if (cl_screen(sp, SC_VI)) return (1); } else if (!F_ISSET(sp, SC_EX_WAIT_YES) && vip->totalcount < 2) { @@ -591,7 +580,7 @@ F_SET(sp, SC_SCR_REFORMAT); /* Ex may have switched out of the alternate screen, return. */ - (void)gp->scr_attr(sp, SA_ALTERNATE, 1); + (void)cl_attr(sp, SA_ALTERNATE, 1); /* * Whew. We're finally back home, after what feels like years. @@ -656,12 +645,12 @@ csp = sp; /* Save the cursor position. */ - (void)gp->scr_cursor(csp, &oldy, &oldx); + (void)cl_cursor(csp, &oldy, &oldx); /* Ring the bell if it's scheduled. */ if (F_ISSET(gp, G_BELLSCHED)) { F_CLR(gp, G_BELLSCHED); - (void)gp->scr_bell(sp); + (void)cl_bell(sp); } /* Display new file status line. */ @@ -683,7 +672,7 @@ if (!F_ISSET(sp, SC_SCR_VI) && vs_refresh(sp, 1)) return (1); while ((mp = LIST_FIRST(&gp->msgq)) != NULL) { - gp->scr_msg(sp, mp->mtype, mp->buf, mp->len); + vs_msg(sp, mp->mtype, mp->buf, mp->len); LIST_REMOVE(mp, q); free(mp->buf); free(mp); @@ -731,7 +720,7 @@ (void)vs_repaint(sp, &ev); /* Restore the cursor position. */ - (void)gp->scr_move(csp, oldy, oldx); + (void)cl_move(csp, oldy, oldx); return (0); } @@ -743,10 +732,8 @@ static void vs_scroll(SCR *sp, int *continuep, sw_t wtype) { - GS *gp; VI_PRIVATE *vip; - gp = sp->gp; vip = VIP(sp); if (!IS_ONELINE(sp)) { /* @@ -754,14 +741,14 @@ * delete the line above the first line output so preserve the * maximum amount of the screen. */ - (void)gp->scr_move(sp, vip->totalcount < - sp->rows ? LASTLINE(sp) - vip->totalcount : 0, 0); - (void)gp->scr_deleteln(sp); + (void)cl_move(sp, vip->totalcount < sp->rows ? + LASTLINE(sp) - vip->totalcount : 0, 0); + (void)cl_deleteln(sp); /* If there are screens below us, push them back into place. */ if (TAILQ_NEXT(sp, q)) { - (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_insertln(sp); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_insertln(sp); } } if (wtype == SCROLL_W_QUIT && vip->linecount < sp->t_maxrows) @@ -785,7 +772,7 @@ gp = sp->gp; vip = VIP(sp); - (void)gp->scr_move(sp, LASTLINE(sp), 0); + (void)cl_move(sp, LASTLINE(sp), 0); if (IS_ONELINE(sp)) p = msg_cmsg(sp, CMSG_CONT_S, &len); else @@ -803,13 +790,13 @@ abort(); /* NOTREACHED */ } - (void)gp->scr_addstr(sp, p, len); + (void)cl_addstr(sp, p, len); ++vip->totalcount; vip->linecount = 0; - (void)gp->scr_clrtoeol(sp); - (void)gp->scr_refresh(sp, 0); + (void)cl_clrtoeol(sp); + (void)cl_refresh(sp, 0); /* Get a single character from the terminal. */ if (continuep != NULL) @@ -824,7 +811,7 @@ F_SET(gp, G_INTERRUPTED); break; } - (void)gp->scr_bell(sp); + (void)cl_bell(sp); } switch (wtype) { case SCROLL_W_QUIT: @@ -847,16 +834,14 @@ static void vs_divider(SCR *sp) { - GS *gp; size_t len; #define DIVIDESTR "+=+=+=+=+=+=+=+" len = sizeof(DIVIDESTR) - 1 > sp->cols ? sp->cols : sizeof(DIVIDESTR) - 1; - gp = sp->gp; - (void)gp->scr_attr(sp, SA_INVERSE, 1); - (void)gp->scr_addstr(sp, DIVIDESTR, len); - (void)gp->scr_attr(sp, SA_INVERSE, 0); + (void)cl_attr(sp, SA_INVERSE, 1); + (void)cl_addstr(sp, DIVIDESTR, len); + (void)cl_attr(sp, SA_INVERSE, 0); } /* Index: vi/vs_refresh.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vs_refresh.c,v retrieving revision 1.19 diff -u -r1.19 vs_refresh.c --- vi/vs_refresh.c 12 Nov 2014 04:28:41 -0000 1.19 +++ vi/vs_refresh.c 20 Nov 2014 20:36:41 -0000 @@ -18,11 +18,14 @@ #include <bitstring.h> #include <ctype.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" #define UPDATE_CURSOR 0x01 /* Update the cursor. */ @@ -133,7 +136,7 @@ vs_resolve(tsp, sp, 0); } if (need_refresh) - (void)gp->scr_refresh(sp, 0); + (void)cl_refresh(sp, 0); /* * A side-effect of refreshing the screen is that it's now ready @@ -156,7 +159,6 @@ static int vs_paint(SCR *sp, u_int flags) { - GS *gp; SMAP *smp, tmp; VI_PRIVATE *vip; recno_t lastline, lcnt; @@ -170,7 +172,6 @@ #define OCNO vip->ocno /* Remembered file column. */ #define SCNO vip->sc_col /* Current screen column. */ - gp = sp->gp; vip = VIP(sp); didpaint = leftright_warp = 0; @@ -270,12 +271,12 @@ return (1); } else { -small_fill: (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_clrtoeol(sp); +small_fill: (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_clrtoeol(sp); for (; sp->t_rows > sp->t_minrows; --sp->t_rows, --TMAP) { - (void)gp->scr_move(sp, TMAP - HMAP, 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_move(sp, TMAP - HMAP, 0); + (void)cl_clrtoeol(sp); } if (vs_sm_fill(sp, LNO, P_FILL)) return (1); @@ -571,7 +572,7 @@ * * We have the current column, retrieve the current row. */ -fast: (void)gp->scr_cursor(sp, &y, ¬used); +fast: (void)cl_cursor(sp, &y, ¬used); goto done_cursor; /* @@ -677,8 +678,8 @@ */ if (F_ISSET(sp, SC_SCR_REDRAW) && IS_SMALL(sp)) for (cnt = sp->t_rows; cnt <= sp->t_maxrows; ++cnt) { - (void)gp->scr_move(sp, cnt, 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_move(sp, cnt, 0); + (void)cl_clrtoeol(sp); } didpaint = 1; @@ -731,7 +732,7 @@ vs_modeline(sp); if (LF_ISSET(UPDATE_CURSOR)) { - (void)gp->scr_move(sp, y, SCNO); + (void)cl_move(sp, y, SCNO); /* * XXX @@ -746,7 +747,7 @@ } if (LF_ISSET(UPDATE_SCREEN)) - (void)gp->scr_refresh(sp, F_ISSET(vip, VIP_N_EX_PAINT)); + (void)cl_refresh(sp, F_ISSET(vip, VIP_N_EX_PAINT)); /* 12: Clear the flags that are handled by this routine. */ F_CLR(sp, SC_SCR_CENTER | SC_SCR_REDRAW | SC_SCR_REFORMAT | SC_SCR_TOP); @@ -776,7 +777,6 @@ "218|Insert", /* SM_INSERT */ "219|Replace", /* SM_REPLACE */ }; - GS *gp; size_t cols, curcol, curlen, endpoint, len, midpoint; const char *t = NULL; int ellipsis; @@ -790,8 +790,6 @@ if (sp->frp == NULL) return; - gp = sp->gp; - /* * We put down the file name, the ruler, the mode and the dirty flag. * If there's not enough room, there's not enough room, we don't play @@ -805,7 +803,7 @@ * * Move to the last line on the screen. */ - (void)gp->scr_move(sp, LASTLINE(sp), 0); + (void)cl_move(sp, LASTLINE(sp), 0); /* If more than one screen in the display, show the file name. */ curlen = 0; @@ -829,18 +827,17 @@ } if (ellipsis) { while (ellipsis--) - (void)gp->scr_addstr(sp, + (void)cl_addstr(sp, KEY_NAME(sp, '.'), KEY_LEN(sp, '.')); - (void)gp->scr_addstr(sp, + (void)cl_addstr(sp, KEY_NAME(sp, ' '), KEY_LEN(sp, ' ')); } for (; *p != '\0'; ++p) - (void)gp->scr_addstr(sp, - KEY_NAME(sp, *p), KEY_LEN(sp, *p)); + (void)cl_addstr(sp, KEY_NAME(sp, *p), KEY_LEN(sp, *p)); } /* Clear the rest of the line. */ - (void)gp->scr_clrtoeol(sp); + (void)cl_clrtoeol(sp); /* * Display the ruler. If we're not at the midpoint yet, move there. @@ -861,13 +858,13 @@ midpoint = (cols - ((len + 1) / 2)) / 2; if (curlen < midpoint) { - (void)gp->scr_move(sp, LASTLINE(sp), midpoint); + (void)cl_move(sp, LASTLINE(sp), midpoint); curlen += len; } else if (curlen + 2 + len < cols) { - (void)gp->scr_addstr(sp, " ", 2); + (void)cl_addstr(sp, " ", 2); curlen += 2 + len; } - (void)gp->scr_addstr(sp, buf, len); + (void)cl_addstr(sp, buf, len); } /* @@ -885,12 +882,12 @@ } if (endpoint > curlen + 2) { - (void)gp->scr_move(sp, LASTLINE(sp), endpoint); + (void)cl_move(sp, LASTLINE(sp), endpoint); if (O_ISSET(sp, O_SHOWMODE)) { if (F_ISSET(sp->ep, F_MODIFIED)) - (void)gp->scr_addstr(sp, + (void)cl_addstr(sp, KEY_NAME(sp, '*'), KEY_LEN(sp, '*')); - (void)gp->scr_addstr(sp, t, len); + (void)cl_addstr(sp, t, len); } } } Index: vi/vs_smap.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vs_smap.c,v retrieving revision 1.8 diff -u -r1.8 vs_smap.c --- vi/vs_smap.c 12 Nov 2014 04:28:41 -0000 1.8 +++ vi/vs_smap.c 20 Nov 2014 20:36:41 -0000 @@ -17,11 +17,14 @@ #include <bitstring.h> #include <limits.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <termios.h> #include "../common/common.h" +#include "../cl/cl.h" #include "vi.h" static int vs_deleteln(SCR *, int); @@ -127,7 +130,7 @@ } /* Save and restore the cursor for these routines. */ - (void)sp->gp->scr_cursor(sp, &oldy, &oldx); + (void)cl_cursor(sp, &oldy, &oldx); switch (op) { case LINE_DELETE: @@ -148,7 +151,7 @@ abort(); } - (void)sp->gp->scr_move(sp, oldy, oldx); + (void)cl_move(sp, oldy, oldx); return (0); } @@ -310,7 +313,7 @@ HANDLE_WEIRDNESS(cnt_orig); /* Delete that many lines from the screen. */ - (void)sp->gp->scr_move(sp, p - HMAP, 0); + (void)cl_move(sp, p - HMAP, 0); if (vs_deleteln(sp, cnt_orig)) return (1); @@ -365,7 +368,7 @@ cnt_orig = cnt; /* Push down that many lines. */ - (void)sp->gp->scr_move(sp, p - HMAP, 0); + (void)cl_move(sp, p - HMAP, 0); if (vs_insertln(sp, cnt_orig)) return (1); @@ -438,7 +441,7 @@ /* If there are any following lines, push them down. */ if (cnt > 1) { - (void)sp->gp->scr_move(sp, p - HMAP, 0); + (void)cl_move(sp, p - HMAP, 0); if (vs_insertln(sp, diff)) return (1); @@ -460,7 +463,7 @@ diff = cnt_orig - cnt_new; /* Delete that many lines from the screen. */ - (void)sp->gp->scr_move(sp, p - HMAP, 0); + (void)cl_move(sp, p - HMAP, 0); if (vs_deleteln(sp, diff)) return (1); @@ -737,7 +740,7 @@ * Delete the top line of the screen. Shift the screen map * up and display a new line at the bottom of the screen. */ - (void)sp->gp->scr_move(sp, 0, 0); + (void)cl_move(sp, 0, 0); if (vs_deleteln(sp, 1)) return (1); @@ -762,19 +765,17 @@ static int vs_deleteln(SCR *sp, int cnt) { - GS *gp; size_t oldy, oldx; - gp = sp->gp; if (IS_ONELINE(sp)) - (void)gp->scr_clrtoeol(sp); + (void)cl_clrtoeol(sp); else { - (void)gp->scr_cursor(sp, &oldy, &oldx); + (void)cl_cursor(sp, &oldy, &oldx); while (cnt--) { - (void)gp->scr_deleteln(sp); - (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_insertln(sp); - (void)gp->scr_move(sp, oldy, oldx); + (void)cl_deleteln(sp); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_insertln(sp); + (void)cl_move(sp, oldy, oldx); } } return (0); @@ -938,14 +939,11 @@ static int vs_sm_erase(SCR *sp) { - GS *gp; - - gp = sp->gp; - (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_clrtoeol(sp); for (; sp->t_rows > sp->t_minrows; --sp->t_rows, --TMAP) { - (void)gp->scr_move(sp, TMAP - HMAP, 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_move(sp, TMAP - HMAP, 0); + (void)cl_clrtoeol(sp); } return (0); } @@ -963,7 +961,7 @@ * Insert a line at the top of the screen. Shift the screen map * down and display a new line at the top of the screen. */ - (void)sp->gp->scr_move(sp, 0, 0); + (void)cl_move(sp, 0, 0); if (vs_insertln(sp, 1)) return (1); @@ -988,20 +986,18 @@ static int vs_insertln(SCR *sp, int cnt) { - GS *gp; size_t oldy, oldx; - gp = sp->gp; if (IS_ONELINE(sp)) { - (void)gp->scr_move(sp, LASTLINE(sp), 0); - (void)gp->scr_clrtoeol(sp); + (void)cl_move(sp, LASTLINE(sp), 0); + (void)cl_clrtoeol(sp); } else { - (void)gp->scr_cursor(sp, &oldy, &oldx); + (void)cl_cursor(sp, &oldy, &oldx); while (cnt--) { - (void)gp->scr_move(sp, LASTLINE(sp) - 1, 0); - (void)gp->scr_deleteln(sp); - (void)gp->scr_move(sp, oldy, oldx); - (void)gp->scr_insertln(sp); + (void)cl_move(sp, LASTLINE(sp) - 1, 0); + (void)cl_deleteln(sp); + (void)cl_move(sp, oldy, oldx); + (void)cl_insertln(sp); } } return (0); Index: vi/vs_split.c =================================================================== RCS file: /cvs/src/usr.bin/vi/vi/vs_split.c,v retrieving revision 1.12 diff -u -r1.12 vs_split.c --- vi/vs_split.c 12 Nov 2014 04:28:41 -0000 1.12 +++ vi/vs_split.c 20 Nov 2014 20:36:41 -0000 @@ -36,13 +36,10 @@ int vs_split(SCR *sp, SCR *new, int ccl) { - GS *gp; SMAP *smp; size_t half; int issmallscreen, splitup; - gp = sp->gp; - /* Check to see if it's possible. */ /* XXX: The IS_ONELINE fix will change this, too. */ if (sp->rows < 4) { @@ -106,7 +103,7 @@ sp->rows -= half; /* Old. */ new->woff = sp->woff + sp->rows; /* Link in after old. */ - TAILQ_INSERT_AFTER(&gp->dq, sp, new, q); + TAILQ_INSERT_AFTER(&sp->gp->dq, sp, new, q); } /* Adjust maximum text count. */ @@ -458,11 +455,8 @@ int vs_resize(SCR *sp, long count, adj_t adj) { - GS *gp; SCR *g, *s; size_t g_off, s_off; - - gp = sp->gp; /* * Figure out which screens will grow, which will shrink, and