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
32
33
34
35
36
37
38
39
40
41
42 #include <stdio.h>
43 #include <dos.h>
44 #include <ws.h>
45 #include <ws_mcb.h>
46 #include <wsmincap.h>
47 #include "wstdefs.h"
48 #include "wstglob.h"
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 async_msg (force_sw)
70 int force_sw;
71
72 {
73
74
75
76 if (fg_msg_showing && strlen (kb.klin) > 0 && ~force_sw)
77 return;
78
79
80
81 if (tdata_arg.minor_capability == FG_CONTROL_MESSAGE) {
82 ctrl_msg ();
83 fg_msg_len = 0;
84 return;
85 }
86
87
88
89
90
91 if (break_sent)
92 fg_msg_len = 0;
93
94 else {
95
96
97 if ((strlen (kb.klin) == 0 && edlin.length < 1) || force_sw) {
98
99
100 if (wst_f_audit)
101 f_audit_msg(fg_msg.text,fg_msg_len);
102
103
104 if (wst_p_audit)
105 p_audit_msg(fg_msg.text,fg_msg_len,NULL);
106
107
108 emit_msg (fg_msg.text, fg_msg_len, ~PSTR);
109 fg_msg_len = 0;
110
111 if (fg_msg_showing) {
112 signal_fg(OFF);
113 fg_msg_showing = OFF;
114 }
115 }
116
117
118
119 else if (~fg_msg_showing) {
120 signal_fg(ON);
121 fg_msg_showing = ON;
122 }
123 }
124 }
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142 sync_msg ()
143 {
144
145
146
147 if (read_active && kb.cndx > 0)
148 extract_msg (~NO_BLOCK, ~TRO, TXMT_MSG, ~HIDE);
149
150
151
152 if (tdata_arg.minor_capability == FG_CONTROL_MESSAGE)
153 ctrl_msg ();
154
155
156
157 else {
158 if (~break_sent) {
159 emit_msg (fg_msg.text, fg_msg_len, ~PSTR);
160
161
162 if (wst_f_audit)
163 f_audit_msg(fg_msg.text,fg_msg_len);
164
165 fg_msg_len = 0;
166 }
167 }
168
169 fg_msg_len = 0;
170 }
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189 ctrl_msg ()
190 {
191 char msg_id [4];
192 int no_blk_sw;
193
194 strncpy (msg_id, fg_msg.ctl.hdr.id, 3);
195 msg_id[3] = 0;
196
197
198
199 if (strcmp (msg_id, "ABT") == 0) {
200 kb.cndx = 0;
201 kb.endx = 0;
202 setmem (kb.pos, sizeof (kb.pos), NUL);
203 setmem (kb.klin, sizeof (kb.klin), NUL);
204 edlin.length = 0;
205 edlin.escape_flag = 0;
206 edlin.escape_arg = -1;
207 edlin.index = 0;
208 }
209
210 else if (strcmp (msg_id, "PON") == 0 || strcmp (msg_id, "POF") ==
211 0) {
212 kb.echo = -(strcmp (msg_id, "PON") == 0);
213
214 }
215
216 else if (strcmp (msg_id, "STM") == 0) {
217 line_kill = fg_msg.ctl.data.stm.kill;
218 char_erase = fg_msg.ctl.data.stm.erase;
219 lnc = fg_msg.ctl.data.stm.lnc;
220 strncpy (erkl_chars, &fg_msg.ctl.data.stm.kill, 3);
221
222
223 screen.maxcol = fg_msg.ctl.data.stm.maxcol;
224 screen.maxlin = fg_msg.ctl.data.stm.maxlin;
225
226
227 sync = -((fg_msg.ctl.data.stm.modes & 1) != 0);
228 crecho = -((fg_msg.ctl.data.stm.modes & 2) != 0);
229 lfecho = -((fg_msg.ctl.data.stm.modes & 4) != 0);
230
231
232 }
233
234 else if (strcmp (msg_id, "SBT") == 0) {
235 strcpy (brk_table, fg_msg.ctl.data.break_table);
236
237 }
238
239 else if (strcmp (msg_id, "ESM") == 0) {
240 strcpy (brk_table, fg_msg.ctl.data.break_table);
241 sync = ON;
242 kb.cndx = 0;
243 kb.endx = 0;
244 setmem (kb.pos, sizeof (kb.pos), NUL);
245 setmem (kb.klin, sizeof (kb.klin), NUL);
246
247 puttdata (FG_CONTROL_MESSAGE, "SME", 3);
248 }
249
250 else if (strcmp (msg_id, "XSM") == 0) {
251
252 sync = OFF;
253 kb.echo = ON;
254 kb.cndx = 0;
255 kb.endx = 0;
256 setmem (kb.klin, sizeof (kb.klin), NUL);
257
258 puttdata (FG_CONTROL_MESSAGE, "SMX", 3);
259 clear_screen ();
260
261 }
262
263 else if (strcmp (msg_id, "RNE") == 0 || strcmp (msg_id, "RWE") ==
264 0) {
265
266
267
268 if (read_active) {
269 term_read = ON;
270 if (kb.cndx > 0)
271 extract_msg (~NO_BLOCK, ~TRO, TXMT_MSG,
272 ~HIDE);
273
274 else
275 send_msg (nul_str, 0);
276 }
277
278 read_count = HI_BYTE_VALUE * fg_msg.ctl.data.rd_ct [0] +
279 fg_msg.ctl.data.rd_ct [1];
280 no_blk_sw = -(fg_msg.ctl.hdr.msb_size && NO_BLOCK_MASK);
281
282
283
284 read_active = ON;
285 kb.echo = -(strcmp (msg_id, "RWE") == 0);
286
287
288
289 if (no_blk_sw) {
290 term_read = ON;
291 if (kb.cndx > 0)
292 extract_msg (~NO_BLOCK, ~TRO, TXMT_MSG,
293 ~HIDE);
294
295 else
296 send_msg (nul_str, 0);
297 }
298 } else {
299
300 }
301 }
302
303
304