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);
                }
        }
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to