summaryrefslogtreecommitdiffstats
path: root/tclsignal/tests/test_sig.tk
diff options
context:
space:
mode:
Diffstat (limited to 'tclsignal/tests/test_sig.tk')
-rwxr-xr-xtclsignal/tests/test_sig.tk31
1 files changed, 31 insertions, 0 deletions
diff --git a/tclsignal/tests/test_sig.tk b/tclsignal/tests/test_sig.tk
new file mode 100755
index 0000000..feca784
--- /dev/null
+++ b/tclsignal/tests/test_sig.tk
@@ -0,0 +1,31 @@
+#!/usr/local/bin/wish4.1
+# ENSURE YOUR TCLLIBPATH includes /usr/local/lib/signal!
+# (or uncomment the appropriate load line and comment the package line)
+# --SUN
+# load /usr/local/lib/signal_ext.so
+# --HP
+# load /usr/local/lib/signal_ext.sl
+package require Signal
+
+signal add 21 { wm iconify . ; wm deiconify . }
+signal add SIGHUP { puts "Signal 1 received" }
+signal add SIGINT { puts "SIGINT received" }
+
+puts "Showing all the signals handled"
+puts [signal print]
+puts "Showing how 3 is handled"
+puts [signal print 3]
+puts "Showing how SIGTTOU is handled"
+puts [signal print SIGTTOU]
+
+frame .bottom
+button .bottom.b -text "Done" -command "exit 0"
+button .bottom.i -text "Iconify" -command "wm iconify ."
+label .l -wraplength 40m -text {
+Sending this process signals 1 (HUP) or 2 (^C or INT) will print messages; signal 21 (URG) will pop it up!
+}
+
+pack .bottom.b -side left -fill x
+pack .bottom.i -side right -fill x
+pack .l -side top -fill both -expand true
+pack .bottom -in . -side bottom -fill x