we don't flush typeahead any more
[unix-history] / usr / src / usr.bin / window / mloop.c
... / ...
CommitLineData
1#ifndef lint
2static char sccsid[] = "@(#)mloop.c 3.6 %G%";
3#endif
4
5#include "defs.h"
6
7mloop()
8{
9 wwrint(); /* catch typeahead before we set ASYNC */
10 while (!quit) {
11 if (incmd) {
12 docmd();
13 } else if (wwcurwin->ww_state != WWS_HASPROC) {
14 setcmd(1);
15 if (wwpeekc() == escapec)
16 (void) wwgetc();
17 error("Process died.");
18 } else {
19 register char *p;
20 register n;
21
22 wwiomux();
23 if (wwibp < wwibq) {
24 for (p = wwibp; p < wwibq && *p != escapec;
25 p++)
26 ;
27 if ((n = p - wwibp) > 0) {
28 (void) write(wwcurwin->ww_pty,
29 wwibp, n);
30 wwibp = p;
31 }
32 if (wwpeekc() == escapec) {
33 (void) wwgetc();
34 setcmd(1);
35 }
36 }
37 }
38 }
39}