chiark / gitweb /
hexbin-term wip
[chiark-utils.git] / scripts / hexterm
index 848312e98e93f9e9595552bfacdaf98a121a454a..249da3d6f7a1d876f75b238292318d3cda7d9ef0 100755 (executable)
@@ -7,6 +7,16 @@ set port [lindex $argv 0]
 set port_stty [exec stty -F $port -g]
 set term_stty [exec stty -g]
 
+proc onreadp {} {
+    global p
+    while 1 {
+       set c [read $p 1]
+       
+}
+
+proc onreadk {} {
+}
+
 set e [catch {
     exec stty          min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \
                       -ctlecho -echo -echoe -echok -echonl -iexten -isig
@@ -17,7 +27,9 @@ set e [catch {
     set p [open $port {RDWR|NONBLOCK} 0]
     fconfigure $p -blocking false -buffering none
     fconfigure stdin -blocking false -buffering none
-    fconfigure stdin -blocking false -buffering none
+
+    fileevent stdin readable onreadk
+    fileevent $p readable onreadp
 }]
 
 fconfigure stdin -blocking true