BSD 4 release
[unix-history] / usr / src / cmd / csh / sh.print.c
index 9f900ce..c298448 100644 (file)
@@ -1,4 +1,5 @@
-/* Copyright (c) 1979 Regents of the University of California */
+static char *sccsid = "@(#)sh.print.c 4.1 10/9/80";
+
 #include "sh.h"
 
 /*
 #include "sh.h"
 
 /*
@@ -40,7 +41,7 @@ p2dig(i)
        printf("%d%d", i / 10, i % 10);
 }
 
        printf("%d%d", i / 10, i % 10);
 }
 
-char   linbuf[64];
+char   linbuf[128];
 char   *linp = linbuf;
 
 putchar(c)
 char   *linp = linbuf;
 
 putchar(c)
@@ -69,24 +70,34 @@ draino()
 flush()
 {
        register int unit;
 flush()
 {
        register int unit;
+       int lmode = 0;
+
+#include <sys/ioctl.h>
 
 
+       if (linp == linbuf)
+               return;
        if (haderr)
                unit = didfds ? 2 : SHDIAG;
        else
                unit = didfds ? 1 : SHOUT;
        if (haderr)
                unit = didfds ? 2 : SHDIAG;
        else
                unit = didfds ? 1 : SHOUT;
-       if (linp != linbuf) {
-               write(unit, linbuf, linp - linbuf);
-               linp = linbuf;
+#ifdef TIOCLGET
+       if (didfds==0 && ioctl(unit, TIOCLGET, &lmode)==0 &&
+           lmode & LFLUSHO) {
+               lmode = LFLUSHO;
+               ioctl(unit, TIOCLBIC, &lmode);
+               write(unit, "\n", 1);
        }
        }
+#endif
+       write(unit, linbuf, linp - linbuf);
+       linp = linbuf;
 }
 
 plist(vp)
        register struct varent *vp;
 {
 }
 
 plist(vp)
        register struct varent *vp;
 {
-       register int (*wasintr)();
 
        if (setintr)
 
        if (setintr)
-               wasintr = signal(SIGINT, pintr);
+               sigrelse(SIGINT);
        for (vp = vp->link; vp != 0; vp = vp->link) {
                int len = blklen(vp->vec);
 
        for (vp = vp->link; vp != 0; vp = vp->link) {
                int len = blklen(vp->vec);
 
@@ -100,5 +111,5 @@ plist(vp)
                printf("\n");
        }
        if (setintr)
                printf("\n");
        }
        if (setintr)
-               signal(SIGINT, wasintr);
+               sigrelse(SIGINT);
 }
 }