Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 May 2011 10:58:58 +0000 (UTC)
From:      Poul-Henning Kamp <phk@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221727 - head/usr.bin/tip/tip
Message-ID:  <201105101058.p4AAwwkv041206@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: phk
Date: Tue May 10 10:58:57 2011
New Revision: 221727
URL: http://svn.freebsd.org/changeset/base/221727

Log:
  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.

Modified:
  head/usr.bin/tip/tip/tipout.c

Modified: head/usr.bin/tip/tip/tipout.c
==============================================================================
--- head/usr.bin/tip/tip/tipout.c	Tue May 10 10:48:43 2011	(r221726)
+++ head/usr.bin/tip/tip/tipout.c	Tue May 10 10:58:57 2011	(r221727)
@@ -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);
 		}
 	}
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105101058.p4AAwwkv041206>