chiark / gitweb /
hexbin-term wip
authorian <ian>
Thu, 8 Dec 2005 13:43:58 +0000 (13:43 +0000)
committerian <ian>
Thu, 8 Dec 2005 13:43:58 +0000 (13:43 +0000)
scripts/hexterm [new file with mode: 0755]

diff --git a/scripts/hexterm b/scripts/hexterm
new file mode 100755 (executable)
index 0000000..848312e
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/tclsh8.4
+
+if {[llength $argv] != 1} { error "need serial port arg" }
+
+set port [lindex $argv 0]
+
+set port_stty [exec stty -F $port -g]
+set term_stty [exec stty -g]
+
+set e [catch {
+    exec stty          min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \
+                      -ctlecho -echo -echoe -echok -echonl -iexten -isig
+    exec stty -F $port min 0 time 0 -istrip -ocrnl -onlcr -onocr -opost \
+                      -ctlecho -echo -echoe -echok -echonl -iexten -isig \
+           9600 clocal cread -crtscts -hup -parenb cs8 -cstopb \
+           -ixoff bs0 cr0 ff0 nl0 -ofill -olcuc -onlcr
+    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
+}]
+
+fconfigure stdin -blocking true
+exec stty $term_stty
+exec stty -F $port $port_stty