date and time created 84/05/06 18:00:10 by edward
[unix-history] / usr / src / usr.bin / window / ttoutput.c
#ifndef lint
static char *sccsid = "@(#)ttoutput.c 3.1 84/03/03";
#endif
#include "ww.h"
#include "tt.h"
#include <sys/errno.h>
/*
* Buffered output package.
* We need this because stdio fails on non-blocking writes.
*/
ttflush()
{
register char *p;
register n;
extern errno;
wwnflush++;
for (p = tt_ob; p < tt_obp;) {
wwnwr++;
n = write(1, p, tt_obp - p);
if (n < 0) {
wwnwre++;
if (errno != EWOULDBLOCK) {
/* can't deal with this */
p = tt_obp;
}
} else if (n == 0) {
/* what to do? */
wwnwrz++;
} else {
wwnwrc += n;
p += n;
}
}
tt_obp = tt_ob;
}
ttputs(s)
register char *s;
{
while (*s)
ttputc(*s++);
}