Commit | Line | Data |
---|---|---|
60de5df9 | 1 | /* |
46e9ea25 KB |
2 | * Copyright (c) 1983 Regents of the University of California. |
3 | * All rights reserved. | |
4 | * | |
87f529ec | 5 | * %sccs.include.redist.c% |
60de5df9 EW |
6 | */ |
7 | ||
46e9ea25 | 8 | #ifndef lint |
87f529ec | 9 | static char sccsid[] = "@(#)mloop.c 3.16 (Berkeley) %G%"; |
46e9ea25 KB |
10 | #endif /* not lint */ |
11 | ||
3e02121b EW |
12 | #include "defs.h" |
13 | ||
14 | mloop() | |
15 | { | |
3e02121b | 16 | while (!quit) { |
ffa20db4 | 17 | if (incmd) { |
3e02121b | 18 | docmd(); |
b1189050 | 19 | } else if (wwcurwin->ww_state != WWS_HASPROC) { |
2422abab EW |
20 | if (!wwcurwin->ww_keepopen) |
21 | closewin(wwcurwin); | |
ffa20db4 | 22 | setcmd(1); |
b1189050 EW |
23 | if (wwpeekc() == escapec) |
24 | (void) wwgetc(); | |
25 | error("Process died."); | |
26 | } else { | |
3fdb475b | 27 | register struct ww *w = wwcurwin; |
b1189050 EW |
28 | register char *p; |
29 | register n; | |
30 | ||
2c279448 EW |
31 | if (wwibp >= wwibq) |
32 | wwiomux(); | |
33 | for (p = wwibp; p < wwibq && *p != escapec; | |
34 | p++) | |
35 | ; | |
36 | if ((n = p - wwibp) > 0) { | |
37 | if (!w->ww_ispty && w->ww_stopped) | |
38 | startwin(w); | |
39 | (void) write(w->ww_pty, wwibp, n); | |
40 | wwibp = p; | |
41 | } | |
42 | if (wwpeekc() == escapec) { | |
43 | (void) wwgetc(); | |
44 | setcmd(1); | |
3e02121b EW |
45 | } |
46 | } | |
47 | } | |
48 | } |