File: test_sig.tk

package info (click to toggle)
tcl-signal 1.4.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 788 kB
  • sloc: ansic: 466; sh: 371; tcl: 51; makefile: 8
file content (31 lines) | stat: -rwxr-xr-x 995 bytes parent folder | download | duplicates (5)
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/bin/env wish
# 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