chiark / gitweb /
much fixes for new arrangements
[ypp-sc-tools.web-live.git] / pctb / show-thing.tcl
index c04d4ddf21b897e56d323e0c1ac17d40a14f8ea3..5356c3292c7c58a276944752d6b16c325b1f5090 100755 (executable)
@@ -26,10 +26,6 @@ set gotsh 20
 set csrh 20
 set ctxh 20
 
-proc debug {m} {
-    puts stderr "SHOW-THING $m"
-}
-
 proc init_widgets {} {
     # idempotent
     global csrh gotsh ctxh
@@ -525,6 +521,7 @@ proc required {} {
     debug "GOT $l"
 
     fileevent stdin readable {}
+    fconfigure stdin -blocking yes
 
     read_xpm stdin
     resize_widgets
@@ -539,14 +536,20 @@ proc main/automatic {} {
 }
 proc done/automatic {} {
     exec sh -c {printf \\0 >&4}
-    fileevent stdin readable required
+    main/automatic
 }
 
-switch -exact -- $argv {
-    {}               { set mainkind test }
-    {--automatic 1}  { set mainkind automatic }
-    {--automatic*}   { error "incompatible versions - install problem" }
-    default          { error "huh $argv ?" }
+proc debug {m} { }
+
+set mainkind test
+foreach arg $argv {
+    switch -exact -- $arg {
+       {--debug}        { proc debug {m} { puts stderr "SHOW-THING $m" } }
+       {--noop-arg}     { }
+       {--automatic-1}  { set mainkind automatic }
+       {--automatic*}   { error "incompatible versions - install problem" }
+       default          { error "huh $argv ?" }
+    }
 }
 
 main/$mainkind