Add spl's around queue manipulation
[unix-history] / usr / src / usr.bin / window / ttoutput.c
CommitLineData
1261567e 1#ifndef lint
7edc52ec 2static char sccsid[] = "@(#)ttoutput.c 3.2 %G%";
1261567e
EW
3#endif
4
5#include "ww.h"
6#include "tt.h"
7#include <sys/errno.h>
8
9/*
10 * Buffered output package.
11 * We need this because stdio fails on non-blocking writes.
12 */
13
14ttflush()
15{
16 register char *p;
17 register n;
18 extern errno;
19
20 wwnflush++;
21 for (p = tt_ob; p < tt_obp;) {
22 wwnwr++;
23 n = write(1, p, tt_obp - p);
24 if (n < 0) {
25 wwnwre++;
26 if (errno != EWOULDBLOCK) {
27 /* can't deal with this */
28 p = tt_obp;
29 }
30 } else if (n == 0) {
31 /* what to do? */
32 wwnwrz++;
33 } else {
34 wwnwrc += n;
35 p += n;
36 }
37 }
38 tt_obp = tt_ob;
39}
40
41ttputs(s)
42register char *s;
43{
44 while (*s)
45 ttputc(*s++);
46}