added "more" command
[unix-history] / usr / src / usr.bin / window / mloop.c
index d0de604..98162dc 100644 (file)
@@ -1,11 +1,18 @@
 #ifndef lint
 #ifndef lint
-static char *sccsid = "@(#)mloop.c     3.4 84/04/05";
+static char sccsid[] = "@(#)mloop.c    3.8 %G%";
 #endif
 
 #endif
 
+/*
+ * Copyright (c) 1983 Regents of the University of California,
+ * All rights reserved.  Redistribution permitted subject to
+ * the terms of the Berkeley Software License Agreement.
+ */
+
 #include "defs.h"
 
 mloop()
 {
 #include "defs.h"
 
 mloop()
 {
+       wwrint();               /* catch typeahead before we set ASYNC */
        while (!quit) {
                if (incmd) {
                        docmd();
        while (!quit) {
                if (incmd) {
                        docmd();
@@ -15,6 +22,7 @@ mloop()
                                (void) wwgetc();
                        error("Process died.");
                } else {
                                (void) wwgetc();
                        error("Process died.");
                } else {
+                       register struct ww *w = wwcurwin;
                        register char *p;
                        register n;
 
                        register char *p;
                        register n;
 
@@ -24,8 +32,9 @@ mloop()
                                     p++)
                                        ;
                                if ((n = p - wwibp) > 0) {
                                     p++)
                                        ;
                                if ((n = p - wwibp) > 0) {
-                                       (void) write(wwcurwin->ww_pty,
-                                               wwibp, n);
+                                       if (!w->ww_ispty && w->ww_stopped)
+                                               startwin(w);
+                                       (void) write(w->ww_pty, wwibp, n);
                                        wwibp = p;
                                }
                                if (wwpeekc() == escapec) {
                                        wwibp = p;
                                }
                                if (wwpeekc() == escapec) {