SCCS-vsn: usr.bin/window/main.c 3.27
SCCS-vsn: usr.bin/window/wwend.c 3.6
SCCS-vsn: usr.bin/window/wwinit.c 3.22
SCCS-vsn: usr.bin/window/wwopen.c 3.18
SCCS-vsn: usr.bin/window/wwtty.c 3.8
SCCS-vsn: usr.bin/window/lcmd1.c 3.27
SCCS-vsn: usr.bin/window/mloop.c 3.6
SCCS-vsn: usr.bin/window/wwsuspend.c 3.6
{ "pty", 1, ARG_ANY },
{ "frame", 1, ARG_ANY },
{ "mapnl", 1, ARG_ANY },
{ "pty", 1, ARG_ANY },
{ "frame", 1, ARG_ANY },
{ "mapnl", 1, ARG_ANY },
- { "shell", 1, ARG_ANY|ARG_LIST },
+ { "shell", 1, ARG_STR|ARG_LIST },
return;
if ((++a)->v_type != V_ERR) {
for (pp = argv; a->v_type != V_ERR &&
return;
if ((++a)->v_type != V_ERR) {
for (pp = argv; a->v_type != V_ERR &&
- pp < &argv[sizeof argv/sizeof *argv-1]; pp++, a++) {
- if (a->v_type == V_NUM && p_convstr(a->v_num) < 0) {
- p_memerror();
- return;
- }
+ pp < &argv[sizeof argv/sizeof *argv-1]; pp++, a++)
*pp = 0;
shf = *(sh = argv);
if (*sh = rindex(shf, '/'))
*pp = 0;
shf = *(sh = argv);
if (*sh = rindex(shf, '/'))
-
-mkargv(p, argv, n)
-register char *p;
-register char **argv;
-register n;
-{
- while (--n > 0) {
- for (; *p && (*p == ' ' || *p == '\t'); p++)
- ;
- if (!*p)
- break;
- *argv++ = p;
- for (; *p && *p != ' ' && *p != '\t'; p++)
- ;
- if (*p)
- *p++ = 0;
- }
- if (n == 0) {
- error("Too many shell arguments.");
- return -1;
- }
- *argv = 0;
- return 0;
-}
-static char sccsid[] = "@(#)main.c 3.26 %G%";
+static char sccsid[] = "@(#)main.c 3.27 %G%";
wwnewtty.ww_tchars.t_startc = wwoldtty.ww_tchars.t_startc;
}
if (debug || xflag)
wwnewtty.ww_tchars.t_startc = wwoldtty.ww_tchars.t_startc;
}
if (debug || xflag)
- (void) wwsettty(0, &wwnewtty);
+ (void) wwsettty(0, &wwnewtty, &wwoldtty);
if ((cmdwin = wwopen(WWO_REVERSE, 1, wwncol, 0, 0, 0)) == 0) {
(void) wwflush();
if ((cmdwin = wwopen(WWO_REVERSE, 1, wwncol, 0, 0, 0)) == 0) {
(void) wwflush();
-static char sccsid[] = "@(#)mloop.c 3.5 %G%";
+static char sccsid[] = "@(#)mloop.c 3.6 %G%";
#endif
#include "defs.h"
mloop()
{
#endif
#include "defs.h"
mloop()
{
+ wwrint(); /* catch typeahead before we set ASYNC */
while (!quit) {
if (incmd) {
docmd();
while (!quit) {
if (incmd) {
docmd();
-static char sccsid[] = "@(#)wwend.c 3.5 %G%";
+static char sccsid[] = "@(#)wwend.c 3.6 %G%";
(*tt.tt_move)(tt.tt_nrow - 1, 0);
(*tt.tt_end)();
ttflush();
(*tt.tt_move)(tt.tt_nrow - 1, 0);
(*tt.tt_end)();
ttflush();
- (void) wwsettty(0, &wwoldtty);
+ (void) wwsettty(0, &wwoldtty, &wwnewtty);
-static char sccsid[] = "@(#)wwinit.c 3.21 %G%";
+static char sccsid[] = "@(#)wwinit.c 3.22 %G%";
wwnewtty.ww_lmode = wwoldtty.ww_lmode | LLITOUT;
wwnewtty.ww_ldisc = wwoldtty.ww_ldisc;
wwnewtty.ww_fflags = wwoldtty.ww_fflags | FASYNC;
wwnewtty.ww_lmode = wwoldtty.ww_lmode | LLITOUT;
wwnewtty.ww_ldisc = wwoldtty.ww_ldisc;
wwnewtty.ww_fflags = wwoldtty.ww_fflags | FASYNC;
-
- if (wwsettty(0, &wwnewtty) < 0)
+ if (wwsettty(0, &wwnewtty, &wwoldtty) < 0)
goto bad;
if ((wwterm = getenv("TERM")) == 0) {
goto bad;
if ((wwterm = getenv("TERM")) == 0) {
* Don't bother to free storage. We're supposed
* to exit when wwinit fails anyway.
*/
* Don't bother to free storage. We're supposed
* to exit when wwinit fails anyway.
*/
- (void) wwsettty(0, &wwoldtty);
+ (void) wwsettty(0, &wwoldtty, &wwnewtty);
(void) signal(SIGIO, SIG_DFL);
(void) sigsetmask(s);
return -1;
(void) signal(SIGIO, SIG_DFL);
(void) sigsetmask(s);
return -1;
-static char sccsid[] = "@(#)wwopen.c 3.17 %G%";
+static char sccsid[] = "@(#)wwopen.c 3.18 %G%";
if (flags & WWO_PTY) {
if (wwgetpty(w) < 0)
goto bad;
if (flags & WWO_PTY) {
if (wwgetpty(w) < 0)
goto bad;
- if (wwsettty(w->ww_pty, &wwwintty) < 0)
+ if (wwsettty(w->ww_pty, &wwwintty, (struct ww_tty *)0) < 0)
goto bad;
w->ww_ispty = 1;
} else if (flags & WWO_SOCKET) {
goto bad;
w->ww_ispty = 1;
} else if (flags & WWO_SOCKET) {
-static char sccsid[] = "@(#)wwsuspend.c 3.5 %G%";
+static char sccsid[] = "@(#)wwsuspend.c 3.6 %G%";
(void) signal(SIGTSTP, SIG_DFL);
(void) kill(0, SIGTSTP);
(void) signal(SIGTSTP, SIG_IGN);
(void) signal(SIGTSTP, SIG_DFL);
(void) kill(0, SIGTSTP);
(void) signal(SIGTSTP, SIG_IGN);
- (void) wwsettty(0, &wwnewtty);
+ (void) wwsettty(0, &wwnewtty, &wwoldtty);
(*tt.tt_init)();
wwredraw();
(void) signal(SIGTSTP, oldsig);
(*tt.tt_init)();
wwredraw();
(void) signal(SIGTSTP, oldsig);
-static char sccsid[] = "@(#)wwtty.c 3.7 %G%";
+static char sccsid[] = "@(#)wwtty.c 3.8 %G%";
-wwsettty(d, t)
-register struct ww_tty *t;
+/*
+ * Set the modes of tty 'd' to 't'
+ * 'o' is the current modes. We set the line discipline only if
+ * it changes, to avoid unnecessary flushing of typeahead.
+ */
+wwsettty(d, t, o)
+register struct ww_tty *t, *o;
{
if (ioctl(d, (int)TIOCSETN, (char *)&t->ww_sgttyb) < 0)
goto bad;
{
if (ioctl(d, (int)TIOCSETN, (char *)&t->ww_sgttyb) < 0)
goto bad;
goto bad;
if (ioctl(d, (int)TIOCLSET, (char *)&t->ww_lmode) < 0)
goto bad;
goto bad;
if (ioctl(d, (int)TIOCLSET, (char *)&t->ww_lmode) < 0)
goto bad;
- if (ioctl(d, (int)TIOCSETD, (char *)&t->ww_ldisc) < 0)
+ if ((o == 0 || t->ww_ldisc != o->ww_ldisc) &&
+ ioctl(d, (int)TIOCSETD, (char *)&t->ww_ldisc) < 0)
goto bad;
if (fcntl(d, F_SETFL, t->ww_fflags) < 0)
goto bad;
goto bad;
if (fcntl(d, F_SETFL, t->ww_fflags) < 0)
goto bad;