0
|
1 ************************************************************
|
|
2 * Send - Sends a signal to a process
|
|
3 *
|
|
4 * By: Boisy G. Pitre
|
|
5 * Southern Station, Box 8455
|
|
6 * Hattiesburg, MS 39406-8455
|
|
7 * Internet: bgpitre@seabass.st.usm.edu
|
|
8 *
|
|
9 * Usage: Send [-signal] procID [...] [-signal] [procID] [...]
|
|
10 *
|
|
11 * Where signal# is a decimal number from 0-255 and procID is the
|
|
12 * process' ID number (obtainable by the PROCS command). The
|
|
13 * default signal is 0 if none is specified. Different signals
|
|
14 * can be sent to different processes on the same command line:
|
|
15 *
|
|
16 * Send -3 45 55 -1 12 4 -0 5 6
|
|
17 *
|
|
18 * ...sends signal 3 to processes 45 and 55, signal 1 to processes
|
|
19 * 12 and 4, and signal 0 to processes 5 and 6.
|
|
20 *
|
|
21 * If a process cannot be killed for whatever reason, an error will
|
|
22 * be printed, and parsing of the line will continue.
|
|
23 *
|
|
24 * Standard Signals:
|
|
25 * 0 - Kill (non-interceptable)
|
|
26 * 1 - Wake up a sleeping process
|
|
27 * 2 - Keyboard terminate
|
|
28 * 3 - Keyboard interrupt
|
|
29 * 4 - Window change
|
|
30 * 128-255 - User defined
|
|
31 *
|
|
32 * For a detailed explanation on signals, see the OS-9 Level II Operating
|
|
33 * System Manual's "Technical Reference" section, page 2-15.
|
|
34 *
|
|
35
|
|
36 nam Send
|
|
37 ttl Signaler utility
|
|
38
|
|
39
|
|
40 ifp1
|
|
41 use defsfile
|
|
42 endc
|
|
43
|
|
44 mod Size,Name,Prgrm+Objct,Reent+1,Start,Finish
|
|
45
|
|
46 Name fcs /Send/
|
|
47 Ed fcb $02
|
|
48
|
|
49 XPlace rmb 1
|
|
50 Signal rmb 1 Holds current signal
|
|
51 stack rmb 200
|
|
52 params rmb 200
|
|
53 Finish equ .
|
|
54
|
|
55 Start decb Check for no params
|
|
56 beq Help If not, show help
|
|
57 clr Signal else clear signal (assume signal 0)
|
|
58
|
|
59 Parse lda ,x+ get char
|
|
60 cmpa #'- dash?
|
|
61 beq GetSig yeah, get signal no
|
|
62 cmpa #$20 space?
|
|
63 beq Parse yeah, get next char
|
|
64 cmpa #$0d eol?
|
|
65 beq Done yeah, exit
|
|
66
|
|
67 KillIt leax -1,x backup on char.. must be a pid
|
|
68 bsr Str2Byte convert to byte
|
|
69 tfr b,a put B (pid) in A
|
|
70 ldb Signal load B with current signal
|
|
71 os9 F$Send and send it to the process
|
|
72 bcc Parse
|
|
73 os9 F$Perr else print the error
|
|
74 bra Parse and continue parsing
|
|
75
|
|
76 Done clrb clear, no error
|
|
77 Error os9 F$Exit exit
|
|
78
|
|
79 GetSig bsr Str2Byte convert to byte
|
|
80 stb Signal save the new signal
|
|
81 bra Parse and resume parsing
|
|
82
|
|
83 *******************************************
|
|
84 * Str2Byte - Converts an ASCII string to a single byte
|
|
85 *
|
|
86 * Entry: X - Address of first char in string
|
|
87 *
|
|
88 * Done: B - Converted byte
|
|
89 * X - Last number in string + 1
|
|
90 *
|
|
91
|
|
92 Str2Byte clrb
|
|
93 cnvloop lda ,x+
|
|
94 cmpa #'9
|
|
95 bhi cnvdone
|
|
96 suba #'0
|
|
97 blo cnvdone
|
|
98 pshs a
|
|
99 lda #10
|
|
100 mul
|
|
101 addb ,s+
|
|
102 bra cnvloop
|
|
103 cnvdone leax -1,x
|
|
104 rts
|
|
105
|
|
106 Help leax HelpMsg,pcr
|
|
107 lda #2
|
|
108 ldy #200
|
|
109 os9 I$WritLn
|
|
110 bcs Error
|
|
111 bra Done
|
|
112
|
|
113 HelpMsg fcc /Usage: Send [-signal] procID [...]/
|
|
114 fcb $0d
|
|
115
|
|
116 emod
|
|
117 Size equ *
|
|
118 end
|