|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1983 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted ! 6: * provided that the above copyright notice and this paragraph are ! 7: * duplicated in all such forms and that any documentation, ! 8: * advertising materials, and other materials related to such ! 9: * distribution and use acknowledge that the software was developed ! 10: * by the University of California, Berkeley. The name of the ! 11: * University may not be used to endorse or promote products derived ! 12: * from this software without specific prior written permission. ! 13: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR ! 14: * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED ! 15: * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 16: */ ! 17: ! 18: #ifndef lint ! 19: static char sccsid[] = "@(#)mloop.c 3.13 (Berkeley) 6/29/88"; ! 20: #endif /* not lint */ ! 21: ! 22: #include "defs.h" ! 23: #include <sys/signal.h> ! 24: ! 25: mloop() ! 26: { ! 27: kill(getpid(), SIGIO); /* catch typeahead before ASYNC was set */ ! 28: while (!quit) { ! 29: if (incmd) { ! 30: docmd(); ! 31: } else if (wwcurwin->ww_state != WWS_HASPROC) { ! 32: if (!wwcurwin->ww_keepopen) ! 33: closewin(wwcurwin); ! 34: setcmd(1); ! 35: if (wwpeekc() == escapec) ! 36: (void) wwgetc(); ! 37: error("Process died."); ! 38: } else { ! 39: register struct ww *w = wwcurwin; ! 40: register char *p; ! 41: register n; ! 42: ! 43: if (wwibp >= wwibq) ! 44: wwiomux(); ! 45: for (p = wwibp; p < wwibq && *p != escapec; ! 46: p++) ! 47: ; ! 48: if ((n = p - wwibp) > 0) { ! 49: if (!w->ww_ispty && w->ww_stopped) ! 50: startwin(w); ! 51: (void) write(w->ww_pty, wwibp, n); ! 52: wwibp = p; ! 53: } ! 54: if (wwpeekc() == escapec) { ! 55: (void) wwgetc(); ! 56: setcmd(1); ! 57: } ! 58: } ! 59: } ! 60: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.