summaryrefslogtreecommitdiffstats
path: root/tclsignal/tests/test_sig.tk
blob: feca784a63cf42d3c8966552a5094e0e5515c107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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