1999-07-25 Gary Houston <ghouston@easynet.co.uk>
authorGary Houston <ghouston@arglist.com>
Sun, 25 Jul 1999 17:45:01 +0000 (17:45 +0000)
committerGary Houston <ghouston@arglist.com>
Sun, 25 Jul 1999 17:45:01 +0000 (17:45 +0000)
* ports.c (scm_putc): fix line-buffering.

(init.c: remove an obsolete comment).

NEWS
libguile/ChangeLog
libguile/init.c
libguile/ports.c

diff --git a/NEWS b/NEWS
index 1490877..6f23159 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -991,7 +991,7 @@ work on any kind of port, not just ports which are open on a file.
 
 ** The procedure truncate-file now works on string ports as well
 as file ports.  If the size argument is omitted, the current
-file position is now used.
+file position is used.
 
 ** new procedure: lseek PORT/FDES OFFSET WHENCE
 The arguments are the same as for the old fseek procedure, but it
index e230fa2..d1ca3e0 100644 (file)
@@ -1,3 +1,7 @@
+1999-07-25  Gary Houston  <ghouston@easynet.co.uk>
+
+       * ports.c (scm_putc): fix line-buffering.
+
 1999-07-25  Mikael Djurfeldt  <mdj@thalamus.nada.kth.se>
 
        * ports.c, ports.h, fports.c, strports.c, vports.c: Renamed
index 7d314e7..4310e9b 100644 (file)
@@ -282,8 +282,6 @@ scm_init_standard_ports ()
      buffered input on stdin can reset \ex{(current-input-port)} to
      block buffering for higher performance.  */
 
-  /* stdout and stderr are also now unbuffered if connected to
-     a terminal, since line buffered output is no longer available.  */
   scm_def_inp
     = scm_standard_stream_to_port (0, 
                                   isatty (0) ? "r0" : "r",
index a7671b7..4081183 100644 (file)
@@ -771,6 +771,13 @@ scm_putc (c, port)
 
   if (pt->write_pos == pt->write_end)
     ptob->fflush (port);
+  else
+    {
+      /* check for line-buffering.  */
+      if ((SCM_CAR (port) & SCM_BUFLINE)
+         && c == '\n')
+       ptob->fflush (port);
+    }
   
   if (pt->rw_random)
     pt->rw_active = SCM_PORT_WRITE;