Flush the scriptfile whenever we see a non-graphical character to get

more real-time logging, without forcing a write(2) on every single
character.
This commit is contained in:
Poul-Henning Kamp 2011-05-10 10:58:57 +00:00
parent 4b89ae574c
commit 9fc9ddee09
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=221727

View File

@ -170,12 +170,18 @@ tipout(void)
if (boolean(value(SCRIPT)) && fscript != NULL) {
if (!boolean(value(BEAUTIFY))) {
fwrite(buf, 1, cnt, fscript);
continue;
} else {
for (cp = buf; cp < buf + cnt; cp++)
if ((*cp >= ' ' && *cp <= '~') ||
any(*cp, value(EXCEPTIONS)))
putc(*cp, fscript);
}
for (cp = buf; cp < buf + cnt; cp++) {
if (!isgraph(*cp)) {
fflush(fscript);
break;
}
}
for (cp = buf; cp < buf + cnt; cp++)
if ((*cp >= ' ' && *cp <= '~') ||
any(*cp, value(EXCEPTIONS)))
putc(*cp, fscript);
}
}
}