aboutsummaryrefslogtreecommitdiff
path: root/examples/tip.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tip.tcl')
-rwxr-xr-xexamples/tip.tcl11
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/tip.tcl b/examples/tip.tcl
index 3de25e3..61ae2cc 100755
--- a/examples/tip.tcl
+++ b/examples/tip.tcl
@@ -105,13 +105,20 @@ stdin ndelay 1
stdout tty output raw
stdout buffering none
+set status ""
+
# I/O loop
set tilde 0
$f readable {
set c [$f read]
- stdout puts -nonewline $c
+ if {[$f eof]} {
+ set status "$device: disconnected"
+ incr done
+ } else {
+ stdout puts -nonewline $c
+ }
}
proc tilde_timeout {} {
@@ -150,4 +157,4 @@ vwait done
stdin tty {*}$stdin_save
stdout tty {*}$stdout_save
-puts ""
+puts $status