Tcl Source Code

Artifact [3f700e44d3]
Login

Artifact 3f700e44d3a600ed06e6db8f628d61ec2db12e77:

Attachment "465279.diff" to ticket [465279ffff] added by andreas_kupries 2001-09-27 12:49:39.
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.635
diff -u -r1.635 ChangeLog
--- ChangeLog	2001/09/27 02:12:19	1.635
+++ ChangeLog	2001/09/27 05:47:56
@@ -1,11 +1,19 @@
 2001-09-26  Andreas Kupries  <[email protected]> 
 
+	* doc/fileevent.n: Accepted [Patch #465279] adding an example to
+	  the fileevent manpage. Minor modifications to get a better
+	  formatting. Report and patch by David N. Welton
+	  <[email protected]>.
+
 	* The changes below fix [Bug #462317] where Expect tried to read
 	  more than was in the buffers and then blocked in the OS call as
 	  its pty channel driver provides no blockmodeproc through which
 	  the OS could be notified of blocking-behaviour. Because of this
 	  the general I/O core has to take more care than usual to
 	  preserve the semantics of non-blocking channels.
+
+	  The problem was reported by "Kevin O'Gorman"
+	  <[email protected]>.
 
 	* generic/tclIO.c (Tcl_ReadRaw): Do not read from the driver if
 	  the channel is non-blocking and the fileevent causing the read
Index: doc/fileevent.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/fileevent.n,v
retrieving revision 1.4
diff -u -r1.4 fileevent.n
--- doc/fileevent.n	2001/09/14 19:20:40	1.4
+++ doc/fileevent.n	2001/09/27 05:47:56
@@ -101,6 +101,21 @@
 an error;  this is done in order to prevent infinite loops due to
 buggy handlers.
 
+.SH EXAMPLE
+.PP
+.CS
+ proc GetData {chan} {
+    if {![eof $chan]} {
+        puts [gets $chan]
+    }
+ }
+
+ fileevent $chan readable [list GetData $chan]
+
+.CE
+In this setup \fBGetData\fR will be called with the channel as an
+argument whenever $chan becomes readable.
+
 .SH CREDITS
 .PP
 \fBfileevent\fR is based on the \fBaddinput\fR command created