Commit 5fa8530ba3c1999ec7daf3c4ca68ea97162eeccc
1 parent
911faecc
Exists in
master
and in
5 other branches
Mais métodos passam a utilizar a estrutura de sessão
Showing
4 changed files
with
110 additions
and
816 deletions
Show diff stats
src/include/lib3270/session.h
@@ -262,6 +262,15 @@ | @@ -262,6 +262,15 @@ | ||
262 | // ft_dft.c | 262 | // ft_dft.c |
263 | int dft_buffersize; /**< Buffer size (LIMIN, LIMOUT) */ | 263 | int dft_buffersize; /**< Buffer size (LIMIN, LIMOUT) */ |
264 | 264 | ||
265 | + // rpq.c | ||
266 | + int rpq_complained : 1; | ||
267 | +#if !defined(_WIN32) | ||
268 | + int omit_due_space_limit : 1; | ||
269 | +#endif | ||
270 | + | ||
271 | + char * rpq_warnbuf; | ||
272 | + int rpq_wbcnt; | ||
273 | + | ||
265 | // Widget info | 274 | // Widget info |
266 | void * widget; | 275 | void * widget; |
267 | 276 |
src/lib3270/glue.c
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | 18 | * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin |
19 | * St, Fifth Floor, Boston, MA 02110-1301 USA | 19 | * St, Fifth Floor, Boston, MA 02110-1301 USA |
20 | * | 20 | * |
21 | - * Este programa está nomeado como glue.c e possui 1103 linhas de código. | 21 | + * Este programa está nomeado como glue.c e possui - linhas de código. |
22 | * | 22 | * |
23 | * Contatos: | 23 | * Contatos: |
24 | * | 24 | * |
@@ -26,7 +26,6 @@ | @@ -26,7 +26,6 @@ | ||
26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
27 | * licinio@bb.com.br (Licínio Luis Branco) | 27 | * licinio@bb.com.br (Licínio Luis Branco) |
28 | * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | 28 | * kraucer@bb.com.br (Kraucer Fernandes Mazuco) |
29 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | ||
30 | * | 29 | * |
31 | */ | 30 | */ |
32 | 31 | ||
@@ -91,175 +90,9 @@ | @@ -91,175 +90,9 @@ | ||
91 | int lib3270_unloaded(void) __attribute__((destructor)); | 90 | int lib3270_unloaded(void) __attribute__((destructor)); |
92 | #endif | 91 | #endif |
93 | 92 | ||
94 | -#ifdef DEBUG | ||
95 | - static int init_calls = 0; | ||
96 | -#endif | ||
97 | - | ||
98 | -// static void lib3270_session_init(H3270 *hSession, const char *model); | ||
99 | - | ||
100 | #define LAST_ARG "--" | 93 | #define LAST_ARG "--" |
101 | 94 | ||
102 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ | 95 | /*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/ |
103 | -// const char * programname; | ||
104 | -// AppRes appres; | ||
105 | -// int children = 0; | ||
106 | -// Boolean exiting = False; | ||
107 | -// char * command_string = CN; | ||
108 | - | ||
109 | -// #if defined(WC3270) || defined(LIB3270) | ||
110 | -// char *profile_name = CN; | ||
111 | -// #endif | ||
112 | - | ||
113 | -/* | ||
114 | - * Set default options | ||
115 | - */ | ||
116 | -static void initialize(void) | ||
117 | -{ | ||
118 | -// memset(&appres,0,sizeof(appres)); | ||
119 | - | ||
120 | -#ifdef DEBUG | ||
121 | - init_calls++; | ||
122 | - trace("Initializing library (calls: %d)",init_calls); | ||
123 | -#endif | ||
124 | - | ||
125 | -// h3270.selected = 0; | ||
126 | -// h3270.select.start = h3270.select.end = 0; | ||
127 | -// initialize_toggles(&h3270); | ||
128 | - | ||
129 | -#if defined(_WIN32) | ||
130 | - (void) get_version_info(); | ||
131 | -#endif | ||
132 | - | ||
133 | - trace("%s (init_calls: %d)",__FUNCTION__,init_calls); | ||
134 | - | ||
135 | - /* Set the defaults. */ | ||
136 | -// appres.mono = False; | ||
137 | -// appres.extended = True; | ||
138 | - | ||
139 | -//#if defined(C3270) /*[*/ | ||
140 | -// h3270.m3279 = True; | ||
141 | -//#endif /*]*/ | ||
142 | - | ||
143 | -// appres.modified_sel = False; | ||
144 | -// appres.apl_mode = False; | ||
145 | - | ||
146 | -/* | ||
147 | -#if defined(C3270) || defined(TCL3270) | ||
148 | - appres.scripted = False; | ||
149 | -#else | ||
150 | - appres.scripted = True; | ||
151 | -#endif | ||
152 | -*/ | ||
153 | - | ||
154 | -// appres.numeric_lock = False; | ||
155 | -// appres.secure = False; | ||
156 | - | ||
157 | -#if defined(C3270) /*[*/ | ||
158 | -// appres.oerr_lock = True; | ||
159 | -#else /*][*/ | ||
160 | -// appres.oerr_lock = False; | ||
161 | -#endif /*]*/ | ||
162 | - | ||
163 | -// appres.typeahead = True; | ||
164 | -// appres.debug_tracing = True; | ||
165 | - | ||
166 | -//#if defined(C3270) | ||
167 | -// appres.compose_map = "latin1"; | ||
168 | -//#endif | ||
169 | - | ||
170 | -// appres.model = ""; | ||
171 | -// appres.hostsfile = CN; | ||
172 | -// appres.port = "telnet"; | ||
173 | - | ||
174 | -// #if !defined(_WIN32) /*[*/ | ||
175 | -// appres.charset = "bracket"; | ||
176 | -// #else /*][*/ | ||
177 | -// | ||
178 | -// if (is_nt) | ||
179 | -// appres.charset = "bracket"; | ||
180 | -// else | ||
181 | -// appres.charset = "bracket437"; | ||
182 | -//#endif /*]*/ | ||
183 | - | ||
184 | -// appres.termname = CN; | ||
185 | -// appres.macros = CN; | ||
186 | - | ||
187 | -#if defined(X3270_TRACE) /*[*/ | ||
188 | - | ||
189 | -/* | ||
190 | -#if !defined(_WIN32) | ||
191 | - appres.trace_dir = "/tmp"; | ||
192 | -#endif | ||
193 | -*/ | ||
194 | - | ||
195 | -/* | ||
196 | -#if defined(X3270_DISPLAY) || defined(WC3270) | ||
197 | - appres.trace_monitor = True; | ||
198 | -#endif | ||
199 | -*/ | ||
200 | - | ||
201 | -#endif /*]*/ | ||
202 | - | ||
203 | -// appres.oversize = CN; | ||
204 | - | ||
205 | -#if defined(C3270) /*[*/ | ||
206 | -// appres.meta_escape = "auto"; | ||
207 | -// appres.curses_keypad = True; | ||
208 | -// appres.cbreak_mode = False; | ||
209 | -#endif /*]*/ | ||
210 | - | ||
211 | -#if defined(X3270_ANSI) | ||
212 | -// appres.icrnl = True; | ||
213 | -// appres.inlcr = False; | ||
214 | -// appres.onlcr = True; | ||
215 | -// appres.erase = "^H"; | ||
216 | -// appres.kill = "^U"; | ||
217 | -// appres.werase = "^W"; | ||
218 | -// appres.rprnt = "^R"; | ||
219 | -// appres.lnext = "^V"; | ||
220 | -// appres.intr = "^C"; | ||
221 | -// appres.quit = "^\\"; | ||
222 | -// appres.eof = "^D"; | ||
223 | -#endif /*]*/ | ||
224 | - | ||
225 | -// appres.unlock_delay = True; | ||
226 | - | ||
227 | -//#if defined(X3270_FT) /*[*/ | ||
228 | -// appres.dft_buffer_size = DFT_BUF; | ||
229 | -//#endif /*]*/ | ||
230 | - | ||
231 | -/* | ||
232 | -#if defined(C3270) && !defined(LIB3270) | ||
233 | - appres.toggle[CURSOR_POS].value = True; | ||
234 | -#endif | ||
235 | -*/ | ||
236 | - | ||
237 | -/* | ||
238 | -#if defined(X3270_SCRIPT) || defined(TCL3270) | ||
239 | - appres.toggle[AID_WAIT].value = True; | ||
240 | -#endif | ||
241 | -*/ | ||
242 | - | ||
243 | -/* | ||
244 | -#if defined(C3270) && defined(X3270_SCRIPT) | ||
245 | - appres.plugin_command = "x3270hist.pl"; | ||
246 | -#endif | ||
247 | -*/ | ||
248 | - | ||
249 | -/* | ||
250 | -#if defined(C3270) && defined(_WIN32) | ||
251 | - appres.highlight_underline = True; | ||
252 | -#endif | ||
253 | -*/ | ||
254 | - | ||
255 | -/* | ||
256 | -#if defined(C3270) && !defined(_WIN32) && !defined(LIB3270) | ||
257 | - // Merge in the profile. | ||
258 | - merge_profile(); | ||
259 | -#endif | ||
260 | -*/ | ||
261 | - | ||
262 | -} | ||
263 | 96 | ||
264 | #if defined WIN32 | 97 | #if defined WIN32 |
265 | 98 | ||
@@ -268,7 +101,7 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) | @@ -268,7 +101,7 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) | ||
268 | // Trace("%s - Library %s",__FUNCTION__,(dwcallpurpose == DLL_PROCESS_ATTACH) ? "Loaded" : "Unloaded"); | 101 | // Trace("%s - Library %s",__FUNCTION__,(dwcallpurpose == DLL_PROCESS_ATTACH) ? "Loaded" : "Unloaded"); |
269 | 102 | ||
270 | if(dwcallpurpose == DLL_PROCESS_ATTACH) | 103 | if(dwcallpurpose == DLL_PROCESS_ATTACH) |
271 | - initialize(); | 104 | + get_version_info(); |
272 | 105 | ||
273 | return TRUE; | 106 | return TRUE; |
274 | } | 107 | } |
@@ -277,8 +110,6 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) | @@ -277,8 +110,6 @@ BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd) | ||
277 | 110 | ||
278 | int lib3270_loaded(void) | 111 | int lib3270_loaded(void) |
279 | { | 112 | { |
280 | -// Trace("%s - Library loaded",__FUNCTION__); | ||
281 | - initialize(); | ||
282 | return 0; | 113 | return 0; |
283 | } | 114 | } |
284 | 115 | ||
@@ -290,555 +121,10 @@ int lib3270_unloaded(void) | @@ -290,555 +121,10 @@ int lib3270_unloaded(void) | ||
290 | #endif | 121 | #endif |
291 | 122 | ||
292 | 123 | ||
293 | -#define offset(n) (void *) &appres.n | ||
294 | -#define toggle_offset(index) offset(toggle[index].value) | ||
295 | - | ||
296 | -/* | ||
297 | - | ||
298 | -static const struct lib3270_option options[] = | ||
299 | -{ | ||
300 | - // TODO (perry#5#): Add option descriptions. | ||
301 | -//#if defined(C3270) | ||
302 | -// { OptAllBold, OPT_BOOLEAN, True, ResAllBold, offset(all_bold_on), NULL }, | ||
303 | -// { OptAltScreen,OPT_STRING, False, ResAltScreen, offset(altscreen), NULL }, | ||
304 | -//#endif | ||
305 | -// { OptAplMode, OPT_BOOLEAN, True, ResAplMode, offset(apl_mode), NULL }, | ||
306 | -#if defined(C3270) | ||
307 | -// { OptCbreak, OPT_BOOLEAN, True, ResCbreak, offset(cbreak_mode), NULL }, | ||
308 | -#endif | ||
309 | -#if defined(HAVE_LIBSSL) | ||
310 | - { OptCertFile, OPT_STRING, False, ResCertFile, offset(cert_file), NULL }, | ||
311 | -#endif | ||
312 | -// { OptCharset, OPT_STRING, False, ResCharset, offset(charset), NULL }, | ||
313 | - { OptClear, OPT_SKIP2, False, NULL, NULL, NULL }, | ||
314 | -// { OptDefScreen,OPT_STRING, False, ResDefScreen, offset(defscreen), NULL }, | ||
315 | -//#if defined(X3270_TRACE) | ||
316 | -// { OptDsTrace, OPT_BOOLEAN, True, ResDsTrace, toggle_offset(DS_TRACE), NULL }, | ||
317 | -//#endif | ||
318 | -// { OptHostsFile,OPT_STRING, False, ResHostsFile, offset(hostsfile), NULL }, | ||
319 | -//#if defined(C3270) | ||
320 | -// { OptKeymap, OPT_STRING, False, ResKeymap, offset(key_map), N_( "Specifies a keymap name and optional modifiers." ) }, | ||
321 | -// #endif | ||
322 | - | ||
323 | -// #if defined(X3270_DBCS) | ||
324 | -// { OptLocalEncoding,OPT_STRING,False,ResLocalEncoding,offset(local_encoding), NULL }, | ||
325 | -//#endif | ||
326 | -// { OptModel, OPT_STRING, False, ResKeymap, offset(model), N_( "Set terminal model (screen size)" ) }, | ||
327 | -// #if !defined(_WIN32) | ||
328 | -// { OptMono, OPT_BOOLEAN, True, ResMono, offset(mono), N_( "Forces monochrome display" ) }, | ||
329 | -// #endif | ||
330 | -// { OptOnce, OPT_BOOLEAN, True, ResOnce, offset(once), NULL }, | ||
331 | -// { OptOversize, OPT_STRING, False, ResOversize, offset(oversize), N_( "Sets the screen dimensions to be larger than the default for the chosen model (COLSxROWS)." ) }, | ||
332 | -// { OptPort, OPT_STRING, False, ResPort, offset(port), N_( "The name of the default TCP port to connect" ) }, | ||
333 | -#if defined(C3270) && !defined(LIB3270) | ||
334 | -// { OptPrinterLu,OPT_STRING, False, ResPrinterLu, offset(printer_lu), NULL }, | ||
335 | -#endif | ||
336 | -// { OptProxy, OPT_STRING, False, ResProxy, offset(proxy), N_( "Proxy server (type:host[:port])" ) }, | ||
337 | -#if defined(S3270) | ||
338 | - { OptScripted, OPT_NOP, False, ResScripted, NULL, NULL }, | ||
339 | -#endif | ||
340 | -//#if defined(C3270) | ||
341 | -// { OptSecure, OPT_BOOLEAN, True, ResSecure, offset(secure), NULL }, | ||
342 | -//#endif | ||
343 | -// { OptSet, OPT_SKIP2, False, NULL, NULL, NULL }, | ||
344 | -#if defined(X3270_SCRIPT) | ||
345 | -// { OptSocket, OPT_BOOLEAN, True, ResSocket, offset(socket), NULL }, | ||
346 | -#endif | ||
347 | - | ||
348 | -// { OptTermName, OPT_STRING, False, ResTermName, offset(termname), N_( "Specifies the terminal name to be transmitted over the telnet connection." ) }, | ||
349 | - | ||
350 | -#if defined(WC3270) | ||
351 | -// { OptTitle, OPT_STRING, False, ResTitle, offset(title), NULL }, | ||
352 | -#endif | ||
353 | -#if defined(X3270_TRACE) | ||
354 | -// { OptTraceFile,OPT_STRING, False, ResTraceFile, offset(trace_file), NULL }, | ||
355 | -// { OptTraceFileSize,OPT_STRING,False,ResTraceFileSize,offset(trace_file_size), NULL }, | ||
356 | -#endif | ||
357 | - { "-xrm", OPT_XRM, False, NULL, NULL, NULL }, | ||
358 | - { LAST_ARG, OPT_DONE, False, NULL, NULL, NULL }, | ||
359 | - { CN, OPT_SKIP2, False, NULL, NULL, NULL } | ||
360 | -}; | ||
361 | -*/ | ||
362 | - | ||
363 | -/* | ||
364 | - * Get library option table | ||
365 | - */ | ||
366 | - /* | ||
367 | -const struct lib3270_option * get_3270_option_table(int sz) | ||
368 | -{ | ||
369 | - if(sz == sizeof(struct lib3270_option)) | ||
370 | - return options; | ||
371 | - return NULL; | ||
372 | -} | ||
373 | -*/ | ||
374 | - | ||
375 | -/* | ||
376 | - * Parse '-xrm' options. | ||
377 | - * Understands only: | ||
378 | - * {c,s,tcl}3270.<resourcename>: value | ||
379 | - * Asterisks and class names need not apply. | ||
380 | - */ | ||
381 | -/* | ||
382 | -static struct { | ||
383 | - const char *name; | ||
384 | - void *address; | ||
385 | - enum resource_type { XRM_STRING, XRM_BOOLEAN, XRM_INT } type; | ||
386 | -} resources[] = { | ||
387 | -// { ResAllBold, offset(all_bold), XRM_STRING }, | ||
388 | -// { ResAltScreen, offset(altscreen), XRM_STRING }, | ||
389 | -// { ResBsdTm, offset(bsd_tm), XRM_BOOLEAN }, | ||
390 | -#if defined(HAVE_LIBSSL) | ||
391 | - { ResCertFile, offset(cert_file), XRM_STRING }, | ||
392 | -#endif | ||
393 | -// { ResCharset, offset(charset), XRM_STRING }, | ||
394 | -// { ResColor8, offset(color8), XRM_BOOLEAN }, | ||
395 | -// { ResConfDir, offset(conf_dir), XRM_STRING }, | ||
396 | -// { ResDefScreen, offset(defscreen), XRM_STRING }, | ||
397 | -#if defined(X3270_ANSI) | ||
398 | -// { ResEof, offset(eof), XRM_STRING }, | ||
399 | -// { ResErase, offset(erase), XRM_STRING }, | ||
400 | -#endif | ||
401 | -// { ResExtended, offset(extended), XRM_BOOLEAN }, | ||
402 | -#if defined(X3270_FT) | ||
403 | -// { ResFtCommand, offset(ft_command), XRM_STRING }, | ||
404 | - { ResDftBufferSize,offset(dft_buffer_size),XRM_INT }, | ||
405 | -#endif | ||
406 | -//#if defined(WC3270) | ||
407 | -// { "hostname", offset(hostname), XRM_STRING }, | ||
408 | -//#endif | ||
409 | -// { ResHostsFile, offset(hostsfile), XRM_STRING }, | ||
410 | -#if defined(X3270_ANSI) | ||
411 | -// { ResIcrnl, offset(icrnl), XRM_BOOLEAN }, | ||
412 | -// { ResInlcr, offset(inlcr), XRM_BOOLEAN }, | ||
413 | -// { ResOnlcr, offset(onlcr), XRM_BOOLEAN }, | ||
414 | -// { ResIntr, offset(intr), XRM_STRING }, | ||
415 | -#endif | ||
416 | -//#if defined(X3270_SCRIPT) | ||
417 | -// { ResPluginCommand, offset(plugin_command), XRM_STRING }, | ||
418 | -//#endif | ||
419 | -//#if defined(C3270) && defined(_WIN32) | ||
420 | -// { ResHighlightUnderline, offset(highlight_underline), XRM_BOOLEAN }, | ||
421 | -//#endif | ||
422 | -#if defined(C3270) && defined(X3270_SCRIPT) | ||
423 | - { ResIdleCommand,offset(idle_command), XRM_STRING }, | ||
424 | - { ResIdleCommandEnabled,offset(idle_command_enabled), XRM_BOOLEAN }, | ||
425 | - { ResIdleTimeout,offset(idle_timeout), XRM_STRING }, | ||
426 | -#endif | ||
427 | -#if defined(C3270) | ||
428 | -// { ResKeymap, offset(key_map), XRM_STRING }, | ||
429 | -// { ResMetaEscape,offset(meta_escape), XRM_STRING }, | ||
430 | -// { ResCursesKeypad,offset(curses_keypad),XRM_BOOLEAN }, | ||
431 | -// { ResCbreak, offset(cbreak_mode), XRM_BOOLEAN }, | ||
432 | -#endif | ||
433 | -#if defined(X3270_ANSI) | ||
434 | -// { ResKill, offset(kill), XRM_STRING }, | ||
435 | -// { ResLnext, offset(lnext), XRM_STRING }, | ||
436 | -#endif | ||
437 | -// { ResLoginMacro,offset(login_macro), XRM_STRING }, | ||
438 | -// { ResM3279, offset(m3279), XRM_BOOLEAN }, | ||
439 | -// { ResModel, offset(model), XRM_STRING }, | ||
440 | -// { ResModifiedSel, offset(modified_sel), XRM_BOOLEAN }, | ||
441 | -//#if defined(C3270) && !defined(_WIN32) | ||
442 | -// { ResMono, offset(mono), XRM_BOOLEAN }, | ||
443 | -//#endif | ||
444 | -// { ResNumericLock, offset(numeric_lock), XRM_BOOLEAN }, | ||
445 | -// { ResOerrLock, offset(oerr_lock), XRM_BOOLEAN }, | ||
446 | -// { ResOversize, offset(oversize), XRM_STRING }, | ||
447 | -// { ResPort, offset(port), XRM_STRING }, | ||
448 | -#if defined(C3270) | ||
449 | -// { ResPrinterLu, offset(printer_lu), XRM_STRING }, | ||
450 | - { ResPrintTextCommand, NULL, XRM_STRING }, | ||
451 | -#endif | ||
452 | -// { ResProxy, offset(proxy), XRM_STRING }, | ||
453 | -#if defined(X3270_ANSI) | ||
454 | -// { ResQuit, offset(quit), XRM_STRING }, | ||
455 | -// { ResRprnt, offset(rprnt), XRM_STRING }, | ||
456 | -#endif | ||
457 | -// { ResSecure, offset(secure), XRM_BOOLEAN }, | ||
458 | -// { ResTermName, offset(termname), XRM_STRING }, | ||
459 | -#if defined(WC3270) | ||
460 | - { ResTitle, offset(title), XRM_STRING }, | ||
461 | -#endif | ||
462 | -#if defined(X3270_TRACE) | ||
463 | -//#if !defined(_WIN32) | ||
464 | -// { ResTraceDir, offset(trace_dir), XRM_STRING }, | ||
465 | -//#endif | ||
466 | -// { ResTraceFile, offset(trace_file), XRM_STRING }, | ||
467 | -// { ResTraceFileSize,offset(trace_file_size),XRM_STRING }, | ||
468 | -#if defined(WC3270) | ||
469 | - { ResTraceMonitor,offset(trace_monitor),XRM_BOOLEAN }, | ||
470 | -#endif | ||
471 | -#endif | ||
472 | -// { ResTypeahead, offset(typeahead), XRM_BOOLEAN }, | ||
473 | -// { ResUnlockDelay,offset(unlock_delay), XRM_BOOLEAN }, | ||
474 | -#if defined(X3270_ANSI) | ||
475 | -// { ResWerase, offset(werase), XRM_STRING }, | ||
476 | -#endif | ||
477 | - | ||
478 | - { CN, 0, XRM_STRING } | ||
479 | -}; | ||
480 | -*/ | ||
481 | - | ||
482 | -/* | ||
483 | - * Compare two strings, allowing the second to differ by uppercasing the | ||
484 | - * first character of the second. | ||
485 | - */ /* | ||
486 | -static int | ||
487 | -strncapcmp(const char *known, const char *unknown, unsigned unk_len) | ||
488 | -{ | ||
489 | - if (unk_len != strlen(known)) | ||
490 | - return -1; | ||
491 | - if (!strncmp(known, unknown, unk_len)) | ||
492 | - return 0; | ||
493 | - if (unk_len > 1 && | ||
494 | - unknown[0] == toupper(known[0]) && | ||
495 | - !strncmp(known + 1, unknown + 1, unk_len - 1)) | ||
496 | - return 0; | ||
497 | - return -1; | ||
498 | -} | ||
499 | -*/ | ||
500 | - | ||
501 | -#if !defined(ME) /*[*/ | ||
502 | -#if defined(C3270) /*[*/ | ||
503 | -#if defined(WC3270) /*[*/ | ||
504 | -#define ME "wc3270" | ||
505 | -#else /*][*/ | ||
506 | -#define ME "c3270" | ||
507 | -#endif /*]*/ | ||
508 | -#elif defined(TCL3270) /*][*/ | ||
509 | -#define ME "tcl3270" | ||
510 | -#else /*][*/ | ||
511 | -#define ME "s3270" | ||
512 | -#endif /*]*/ | ||
513 | -#endif /*]*/ | ||
514 | - | ||
515 | -/* | ||
516 | -void | ||
517 | -parse_xrm(const char *arg, const char *where) | ||
518 | -{ | ||
519 | - static char me_dot[] = ME "."; | ||
520 | - static char me_star[] = ME "*"; | ||
521 | - unsigned match_len; | ||
522 | - const char *s; | ||
523 | - unsigned rnlen; | ||
524 | - int i; | ||
525 | - char *t; | ||
526 | - void *address = NULL; | ||
527 | - enum resource_type type = XRM_STRING; | ||
528 | -#if defined(C3270) | ||
529 | - char *add_buf = CN; | ||
530 | - char *hide; | ||
531 | - Boolean arbitrary = False; | ||
532 | -#endif | ||
533 | - | ||
534 | - // Enforce "-3270." or "-3270*" or "*". | ||
535 | - if (!strncmp(arg, me_dot, sizeof(me_dot)-1)) | ||
536 | - match_len = sizeof(me_dot)-1; | ||
537 | - else if (!strncmp(arg, me_star, sizeof(me_star)-1)) | ||
538 | - match_len = sizeof(me_star)-1; | ||
539 | - else if (arg[0] == '*') | ||
540 | - match_len = 1; | ||
541 | - else { | ||
542 | - xs_warning("%s: Invalid resource syntax '%.*s', name must " | ||
543 | - "begin with '%s'", | ||
544 | - where, (int) sizeof(me_dot)-1, arg, me_dot); | ||
545 | - return; | ||
546 | - } | ||
547 | - | ||
548 | - // Separate the parts. | ||
549 | - s = arg + match_len; | ||
550 | - while (*s && *s != ':' && !isspace(*s)) | ||
551 | - s++; | ||
552 | - rnlen = s - (arg + match_len); | ||
553 | - if (!rnlen) { | ||
554 | - xs_warning("%s: Invalid resource syntax, missing resource " | ||
555 | - "name", where); | ||
556 | - return; | ||
557 | - } | ||
558 | - while (isspace(*s)) | ||
559 | - s++; | ||
560 | - if (*s != ':') { | ||
561 | - xs_warning("%s: Invalid resource syntax, missing ':'", where); | ||
562 | - return; | ||
563 | - } | ||
564 | - s++; | ||
565 | - while (isspace(*s)) | ||
566 | - s++; | ||
567 | - | ||
568 | - // Look up the name. | ||
569 | - for (i = 0; resources[i].name != CN; i++) { | ||
570 | - if (!strncapcmp(resources[i].name, arg + match_len, rnlen)) { | ||
571 | - address = resources[i].address; | ||
572 | - type = resources[i].type; | ||
573 | -#if defined(C3270) | ||
574 | - if (address == NULL) { | ||
575 | - add_buf = lib3270_malloc(strlen(s) + 1); | ||
576 | - address = add_buf; | ||
577 | - } | ||
578 | -#endif | ||
579 | - break; | ||
580 | - } | ||
581 | - } | ||
582 | - | ||
583 | -#if defined(C3270) | ||
584 | - if (address == NULL) { | ||
585 | - if (!strncasecmp(ResKeymap ".", arg + match_len, | ||
586 | - strlen(ResKeymap ".")) || | ||
587 | - !strncasecmp(ResCharset ".", arg + match_len, | ||
588 | - strlen(ResCharset ".")) || | ||
589 | - !strncasecmp(ResDisplayCharset ".", arg + match_len, | ||
590 | - strlen(ResDisplayCharset ".")) || | ||
591 | - !strncasecmp(ResCodepage ".", arg + match_len, | ||
592 | - strlen(ResCodepage ".")) || | ||
593 | - !strncasecmp("host.", arg + match_len, 5) || | ||
594 | - !strncasecmp("printer.", arg + match_len, 8) || | ||
595 | -#if defined(_WIN32) | ||
596 | - !strncasecmp(ResHostColorFor, arg + match_len, | ||
597 | - strlen(ResHostColorFor)) || | ||
598 | - !strncasecmp(ResConsoleColorForHostColor, arg + match_len, | ||
599 | - strlen(ResConsoleColorForHostColor)) | ||
600 | -#else | ||
601 | - !strncasecmp(ResCursesColorFor, arg + match_len, | ||
602 | - strlen(ResCursesColorFor)) | ||
603 | -#endif | ||
604 | - ) { | ||
605 | - address = &hide; | ||
606 | - type = XRM_STRING; | ||
607 | - arbitrary = True; | ||
608 | - } | ||
609 | - } | ||
610 | -#endif | ||
611 | - if (address == NULL) { | ||
612 | - xs_warning("%s: Unknown resource name: %.*s", | ||
613 | - where, (int)rnlen, arg + match_len); | ||
614 | - return; | ||
615 | - } | ||
616 | - switch (type) { | ||
617 | - case XRM_BOOLEAN: | ||
618 | - if (!strcasecmp(s, "true") || | ||
619 | - !strcasecmp(s, "t") || | ||
620 | - !strcmp(s, "1")) { | ||
621 | - *(Boolean *)address = True; | ||
622 | - } else if (!strcasecmp(s, "false") || | ||
623 | - !strcasecmp(s, "f") || | ||
624 | - !strcmp(s, "0")) { | ||
625 | - *(Boolean *)address = False; | ||
626 | - } else { | ||
627 | - xs_warning("%s: Invalid Boolean value: %s", where, s); | ||
628 | - } | ||
629 | - break; | ||
630 | - case XRM_STRING: | ||
631 | - t = lib3270_malloc(strlen(s) + 1); | ||
632 | - *(char **)address = t; | ||
633 | - if (*s == '"') { | ||
634 | - Boolean quoted = False; | ||
635 | - char c; | ||
636 | - | ||
637 | - s++; | ||
638 | - while ((c = *s++) != '\0') { | ||
639 | - if (quoted) { | ||
640 | - switch (c) { | ||
641 | - case 'n': | ||
642 | - *t++ = '\n'; | ||
643 | - break; | ||
644 | - case 'r': | ||
645 | - *t++ = '\r'; | ||
646 | - break; | ||
647 | - case 'b': | ||
648 | - *t++ = '\b'; | ||
649 | - break; | ||
650 | - default: | ||
651 | - *t++ = c; | ||
652 | - break; | ||
653 | - } | ||
654 | - quoted = False; | ||
655 | - } else if (c == '\\') { | ||
656 | - quoted = True; | ||
657 | - } else if (c == '"') { | ||
658 | - break; | ||
659 | - } else { | ||
660 | - *t++ = c; | ||
661 | - } | ||
662 | - } | ||
663 | - *t = '\0'; | ||
664 | - } else { | ||
665 | - (void) strcpy(t, s); | ||
666 | - } | ||
667 | - break; | ||
668 | - case XRM_INT: { | ||
669 | - long n; | ||
670 | - char *ptr; | ||
671 | - | ||
672 | - n = strtol(s, &ptr, 0); | ||
673 | - if (*ptr != '\0') { | ||
674 | - xs_warning("%s: Invalid Integer value: %s", where, s); | ||
675 | - } else { | ||
676 | - *(int *)address = (int)n; | ||
677 | - } | ||
678 | - break; | ||
679 | - } | ||
680 | - } | ||
681 | - | ||
682 | -#if defined(C3270) | ||
683 | - // Add a new, arbitrarily-named resource. | ||
684 | - if (arbitrary) { | ||
685 | - char *rsname; | ||
686 | - | ||
687 | - rsname = lib3270_malloc(rnlen + 1); | ||
688 | - (void) strncpy(rsname, arg + match_len, rnlen); | ||
689 | - rsname[rnlen] = '\0'; | ||
690 | - add_resource(rsname, hide); | ||
691 | - } | ||
692 | -#endif | ||
693 | -} | ||
694 | -*/ | ||
695 | - | ||
696 | -/* Read resources from a file. */ /* | ||
697 | -int | ||
698 | -read_resource_file(const char *filename, Boolean fatal) | ||
699 | -{ | ||
700 | - FILE *f; | ||
701 | - int ilen; | ||
702 | - char buf[4096]; | ||
703 | - char *where; | ||
704 | - int lno = 0; | ||
705 | - | ||
706 | - f = fopen(filename, "r"); | ||
707 | - if (f == NULL) { | ||
708 | - if (fatal) | ||
709 | - xs_warning("Cannot open '%s': %s", filename, | ||
710 | - strerror(errno)); | ||
711 | - return -1; | ||
712 | - } | ||
713 | - | ||
714 | - // Merge in what's in the file into the resource database. | ||
715 | - where = lib3270_malloc(strlen(filename) + 64); | ||
716 | - | ||
717 | - ilen = 0; | ||
718 | - while (fgets(buf + ilen, sizeof(buf) - ilen, f) != CN || ilen) { | ||
719 | - char *s, *t; | ||
720 | - unsigned sl; | ||
721 | - Boolean bsl; | ||
722 | - | ||
723 | - lno++; | ||
724 | - | ||
725 | - // Stip any trailing newline. | ||
726 | - sl = strlen(buf + ilen); | ||
727 | - if (sl && (buf + ilen)[sl-1] == '\n') | ||
728 | - (buf + ilen)[--sl] = '\0'; | ||
729 | - | ||
730 | - // | ||
731 | - //Translate backslash-n to real newline characters, and | ||
732 | - // remember if the last character is a backslash. | ||
733 | - // | ||
734 | - for (bsl = False, s = buf + ilen, t = s; *s; s++) { | ||
735 | - if (bsl) { | ||
736 | - if (*s == 'n') | ||
737 | - *t++ = '\n'; | ||
738 | - else | ||
739 | - *t++ = *s; | ||
740 | - bsl = False; | ||
741 | - } else if (*s == '\\') | ||
742 | - bsl = True; | ||
743 | - else { | ||
744 | - *t++ = *s; | ||
745 | - bsl = False; | ||
746 | - } | ||
747 | - } | ||
748 | - *t = '\0'; | ||
749 | - | ||
750 | - // Skip leading whitespace. | ||
751 | - s = buf; | ||
752 | - while (isspace(*s)) | ||
753 | - s++; | ||
754 | - | ||
755 | - // Skip comments _before_ checking for line continuation. | ||
756 | - if (*s == '!') { | ||
757 | - ilen = 0; | ||
758 | - continue; | ||
759 | - } | ||
760 | - if (*s == '#') { | ||
761 | - (void) sprintf(where, "%s:%d: Invalid profile " | ||
762 | - "syntax ('#' ignored)", filename, lno); | ||
763 | - Warning(NULL,where); | ||
764 | - ilen = 0; | ||
765 | - continue; | ||
766 | - } | ||
767 | - | ||
768 | - // If this line is a continuation, try again. | ||
769 | - if (bsl) { | ||
770 | - ilen += strlen(buf + ilen); | ||
771 | - if (ilen >= sizeof(buf) - 1) { | ||
772 | - (void) sprintf(where, "%s:%d: Line too long\n", | ||
773 | - filename, lno); | ||
774 | - Warning(NULL,where); | ||
775 | - break; | ||
776 | - } | ||
777 | - continue; | ||
778 | - } | ||
779 | - | ||
780 | - // Strip trailing whitespace and check for empty lines. | ||
781 | - sl = strlen(s); | ||
782 | - while (sl && isspace(s[sl-1])) | ||
783 | - s[--sl] = '\0'; | ||
784 | - if (!sl) { | ||
785 | - ilen = 0; | ||
786 | - continue; | ||
787 | - } | ||
788 | - | ||
789 | - // Digest it. | ||
790 | - (void) sprintf(where, "%s:%d", filename, lno); | ||
791 | - parse_xrm(s, where); | ||
792 | - | ||
793 | - // Get ready for the next iteration. | ||
794 | - ilen = 0; | ||
795 | - } | ||
796 | - lib3270_free(where); | ||
797 | - return 0; | ||
798 | -} | ||
799 | - | ||
800 | -// Boolean flipped = False; | ||
801 | -*/ | ||
802 | - | ||
803 | -/* Replacements for functions in popups.c. */ | ||
804 | - | ||
805 | -// Boolean error_popup_visible = False; | ||
806 | - | ||
807 | - | ||
808 | #ifdef DEBUG | 124 | #ifdef DEBUG |
809 | extern void lib3270_initialize(void) | 125 | extern void lib3270_initialize(void) |
810 | { | 126 | { |
811 | - initialize(); | ||
812 | } | 127 | } |
813 | #endif | 128 | #endif |
814 | 129 | ||
815 | 130 | ||
816 | -/* | ||
817 | -void | ||
818 | -action_output(const char *fmt, ...) | ||
819 | -{ | ||
820 | -// TODO (perry#1#): Implement a callback to browse the text string. | ||
821 | - va_list args; | ||
822 | - | ||
823 | - va_start(args, fmt); | ||
824 | - (void) vsprintf(vmsgbuf, fmt, args); | ||
825 | - va_end(args); | ||
826 | - if (sms_redirect()) { | ||
827 | - sms_info("%s", vmsgbuf); | ||
828 | - return; | ||
829 | - } else { | ||
830 | - FILE *aout; | ||
831 | - | ||
832 | -#if defined(C3270) || defined(WC3270) | ||
833 | - screen_suspend(); | ||
834 | -// aout = start_pager(); | ||
835 | -// any_error_output = True; | ||
836 | -#else | ||
837 | - aout = stdout; | ||
838 | -#endif | ||
839 | - (void) fprintf(aout, "%s\n", vmsgbuf); | ||
840 | - macro_output = True; | ||
841 | - } | ||
842 | -} | ||
843 | -*/ | ||
844 | - |
src/lib3270/rpq.c
@@ -66,19 +66,21 @@ | @@ -66,19 +66,21 @@ | ||
66 | #include "sf.h" | 66 | #include "sf.h" |
67 | 67 | ||
68 | /* Statics */ | 68 | /* Statics */ |
69 | -static Boolean select_rpq_terms(void); | ||
70 | -static int get_rpq_timezone(void); | ||
71 | -static int get_rpq_user(unsigned char buf[], const int buflen); | 69 | +static Boolean select_rpq_terms(H3270 *hSession); |
70 | +static int get_rpq_timezone(H3270 *hSession); | ||
71 | +static int get_rpq_user(H3270 *hSession, unsigned char buf[], const int buflen); | ||
72 | #if !defined(_WIN32) /*[*/ | 72 | #if !defined(_WIN32) /*[*/ |
73 | -static int get_rpq_address(unsigned char buf[], const int buflen); | 73 | +static int get_rpq_address(H3270 *hSession, unsigned char buf[], const int buflen); |
74 | #endif /*]*/ | 74 | #endif /*]*/ |
75 | -static void rpq_warning(const char *fmt, ...); | ||
76 | -static void rpq_dump_warnings(void); | ||
77 | -static Boolean rpq_complained = False; | 75 | +static void rpq_warning(H3270 *hSession, const char *fmt, ...) printflike(2,3); |
76 | +static void rpq_dump_warnings(H3270 *hSession); | ||
78 | 77 | ||
79 | -#if !defined(_WIN32) /*[*/ | ||
80 | -static Boolean omit_due_space_limit = False; | ||
81 | -#endif /*]*/ | 78 | + |
79 | +// static Boolean rpq_complained = 0; | ||
80 | +// | ||
81 | +// #if !defined(_WIN32) | ||
82 | +//static Boolean omit_due_space_limit = 0; | ||
83 | +//#endif | ||
82 | 84 | ||
83 | /* | 85 | /* |
84 | * Define symbolic names for RPQ self-defining terms. | 86 | * Define symbolic names for RPQ self-defining terms. |
@@ -101,9 +103,10 @@ static Boolean omit_due_space_limit = False; | @@ -101,9 +103,10 @@ static Boolean omit_due_space_limit = False; | ||
101 | * specifies abbreviations, they work in a predictable manner. E.g., "TIME" | 103 | * specifies abbreviations, they work in a predictable manner. E.g., "TIME" |
102 | * should match TIMESTAMP instead of TIMEZONE. | 104 | * should match TIMESTAMP instead of TIMEZONE. |
103 | */ | 105 | */ |
104 | -static struct rpq_keyword { | ||
105 | - Boolean omit; /* set from X3270RPQ="kw1:kw2..." environment var */ | ||
106 | - int oride; /* displacement */ | 106 | +static struct rpq_keyword |
107 | +{ | ||
108 | + Boolean omit; /**< set from X3270RPQ="kw1:kw2..." environment var */ | ||
109 | + int oride; /**< displacement */ | ||
107 | const Boolean allow_oride; | 110 | const Boolean allow_oride; |
108 | const unsigned char id; | 111 | const unsigned char id; |
109 | const char *text; | 112 | const char *text; |
@@ -112,7 +115,7 @@ static struct rpq_keyword { | @@ -112,7 +115,7 @@ static struct rpq_keyword { | ||
112 | {True, 0, True, RPQ_ADDRESS, "ADDRESS"}, | 115 | {True, 0, True, RPQ_ADDRESS, "ADDRESS"}, |
113 | {True, 0, False, RPQ_TIMESTAMP, "TIMESTAMP"}, | 116 | {True, 0, False, RPQ_TIMESTAMP, "TIMESTAMP"}, |
114 | {True, 0, True, RPQ_TIMEZONE, "TIMEZONE"}, | 117 | {True, 0, True, RPQ_TIMEZONE, "TIMEZONE"}, |
115 | - {True, 0, True, RPQ_USER, "USER"}, | 118 | + {True, 0, True, RPQ_USER, "USER"}, |
116 | {True, 0, False, RPQ_VERSION, "VERSION"}, | 119 | {True, 0, False, RPQ_VERSION, "VERSION"}, |
117 | }; | 120 | }; |
118 | #define NS_RPQ (sizeof(rpq_keywords)/sizeof(rpq_keywords[0])) | 121 | #define NS_RPQ (sizeof(rpq_keywords)/sizeof(rpq_keywords[0])) |
@@ -141,31 +144,31 @@ void do_qr_rpqnames(H3270 *hSession) | @@ -141,31 +144,31 @@ void do_qr_rpqnames(H3270 *hSession) | ||
141 | */ | 144 | */ |
142 | space3270out(hSession,4+4+1+remaining); /* Maximum space for an RPQNAME item */ | 145 | space3270out(hSession,4+4+1+remaining); /* Maximum space for an RPQNAME item */ |
143 | 146 | ||
144 | - SET32(h3270.obptr, 0); /* Device number, 0 = All */ | ||
145 | - SET32(h3270.obptr, 0); /* Model number, 0 = All */ | 147 | + SET32(hSession->obptr, 0); /* Device number, 0 = All */ |
148 | + SET32(hSession->obptr, 0); /* Model number, 0 = All */ | ||
146 | 149 | ||
147 | - rpql = h3270.obptr++; /* Save address to place data length. */ | 150 | + rpql = hSession->obptr++; /* Save address to place data length. */ |
148 | 151 | ||
149 | /* Create fixed length portion - program id: x3270 */ | 152 | /* Create fixed length portion - program id: x3270 */ |
150 | for (j = 0; j < 5; j++) { | 153 | for (j = 0; j < 5; j++) { |
151 | - *h3270.obptr++ = asc2ebc[(int)"x3270"[j]]; | 154 | + *hSession->obptr++ = asc2ebc[(int)"x3270"[j]]; |
152 | remaining--; | 155 | remaining--; |
153 | } | 156 | } |
154 | 157 | ||
155 | /* Create user selected variable-length self-defining terms. */ | 158 | /* Create user selected variable-length self-defining terms. */ |
156 | - select_rpq_terms(); | 159 | + select_rpq_terms(hSession); |
157 | 160 | ||
158 | for (j=0; j<NS_RPQ; j++) { | 161 | for (j=0; j<NS_RPQ; j++) { |
159 | if (rpq_keywords[j].omit) | 162 | if (rpq_keywords[j].omit) |
160 | continue; | 163 | continue; |
161 | 164 | ||
162 | - omit_due_space_limit = False; | 165 | + omit_due_space_limit = 0; |
163 | 166 | ||
164 | term_id = rpq_keywords[j].id; | 167 | term_id = rpq_keywords[j].id; |
165 | 168 | ||
166 | - p_term = h3270.obptr; /* save starting address (to insert length later) */ | ||
167 | - h3270.obptr++; /* skip length of term, fill in later */ | ||
168 | - *h3270.obptr++ = term_id; /* identify this term */ | 169 | + p_term = hSession->obptr; /* save starting address (to insert length later) */ |
170 | + hSession->obptr++; /* skip length of term, fill in later */ | ||
171 | + *hSession->obptr++ = term_id; /* identify this term */ | ||
169 | 172 | ||
170 | /* | 173 | /* |
171 | * Adjust remaining space by the term prefix size so each case | 174 | * Adjust remaining space by the term prefix size so each case |
@@ -177,18 +180,18 @@ void do_qr_rpqnames(H3270 *hSession) | @@ -177,18 +180,18 @@ void do_qr_rpqnames(H3270 *hSession) | ||
177 | 180 | ||
178 | switch (term_id) { /* build the term based on id */ | 181 | switch (term_id) { /* build the term based on id */ |
179 | case RPQ_USER: /* User text from env. vars */ | 182 | case RPQ_USER: /* User text from env. vars */ |
180 | - h3270.obptr += get_rpq_user(h3270.obptr, remaining); | 183 | + hSession->obptr += get_rpq_user(hSession,hSession->obptr, remaining); |
181 | break; | 184 | break; |
182 | 185 | ||
183 | case RPQ_TIMEZONE: /* UTC time offset */ | 186 | case RPQ_TIMEZONE: /* UTC time offset */ |
184 | omit_due_space_limit = (remaining < 2); | 187 | omit_due_space_limit = (remaining < 2); |
185 | if (!omit_due_space_limit) | 188 | if (!omit_due_space_limit) |
186 | - SET16(h3270.obptr, get_rpq_timezone()); | 189 | + SET16(hSession->obptr, get_rpq_timezone(hSession)); |
187 | break; | 190 | break; |
188 | 191 | ||
189 | case RPQ_ADDRESS: /* Workstation address */ | 192 | case RPQ_ADDRESS: /* Workstation address */ |
190 | #if !defined(_WIN32) /*[*/ | 193 | #if !defined(_WIN32) /*[*/ |
191 | - hSession->obptr += get_rpq_address(hSession->obptr, remaining); | 194 | + hSession->obptr += get_rpq_address(hSession, hSession->obptr, remaining); |
192 | #endif /*]*/ | 195 | #endif /*]*/ |
193 | break; | 196 | break; |
194 | 197 | ||
@@ -204,7 +207,7 @@ void do_qr_rpqnames(H3270 *hSession) | @@ -204,7 +207,7 @@ void do_qr_rpqnames(H3270 *hSession) | ||
204 | 207 | ||
205 | case RPQ_TIMESTAMP: /* program build time (yyyymmddhhmmss bcd) */ | 208 | case RPQ_TIMESTAMP: /* program build time (yyyymmddhhmmss bcd) */ |
206 | x = strlen(build_rpq_timestamp); | 209 | x = strlen(build_rpq_timestamp); |
207 | - omit_due_space_limit = ((x+1)/2 > remaining); | 210 | + omit_due_space_limit = ((x+1)/2 > remaining) ? 1 : 0; |
208 | if (!omit_due_space_limit) { | 211 | if (!omit_due_space_limit) { |
209 | for (i=0; i < x; i+=2) { | 212 | for (i=0; i < x; i+=2) { |
210 | *hSession->obptr++ = ((*(build_rpq_timestamp+i) - '0') << 4) | 213 | *hSession->obptr++ = ((*(build_rpq_timestamp+i) - '0') << 4) |
@@ -214,12 +217,12 @@ void do_qr_rpqnames(H3270 *hSession) | @@ -214,12 +217,12 @@ void do_qr_rpqnames(H3270 *hSession) | ||
214 | break; | 217 | break; |
215 | 218 | ||
216 | default: /* unsupported ID, (can't happen) */ | 219 | default: /* unsupported ID, (can't happen) */ |
217 | - Error(NULL,"Unsupported RPQ term"); | 220 | + Error(hSession,_( "Unsupported RPQ term" )); |
218 | break; | 221 | break; |
219 | } | 222 | } |
220 | 223 | ||
221 | if (omit_due_space_limit) | 224 | if (omit_due_space_limit) |
222 | - rpq_warning("RPQ %s term omitted due to insufficient space", rpq_keywords[j].text); | 225 | + rpq_warning(hSession, _( "RPQ %s term omitted due to insufficient space" ), rpq_keywords[j].text); |
223 | /* | 226 | /* |
224 | * The item is built, insert item length as needed and | 227 | * The item is built, insert item length as needed and |
225 | * adjust space remaining. | 228 | * adjust space remaining. |
@@ -256,12 +259,11 @@ void do_qr_rpqnames(H3270 *hSession) | @@ -256,12 +259,11 @@ void do_qr_rpqnames(H3270 *hSession) | ||
256 | /* Fill in overall length of RPQNAME info */ | 259 | /* Fill in overall length of RPQNAME info */ |
257 | *rpql = (hSession->obptr - rpql); | 260 | *rpql = (hSession->obptr - rpql); |
258 | 261 | ||
259 | - rpq_dump_warnings(); | 262 | + rpq_dump_warnings(hSession); |
260 | } | 263 | } |
261 | 264 | ||
262 | /* Utility function used by the RPQNAMES query reply. */ | 265 | /* Utility function used by the RPQNAMES query reply. */ |
263 | -static Boolean | ||
264 | -select_rpq_terms(void) | 266 | +static Boolean select_rpq_terms(H3270 *hSession) |
265 | { | 267 | { |
266 | int i,j,k,len; | 268 | int i,j,k,len; |
267 | char *uplist; | 269 | char *uplist; |
@@ -330,9 +332,7 @@ select_rpq_terms(void) | @@ -330,9 +332,7 @@ select_rpq_terms(void) | ||
330 | if (rpq_keywords[j].allow_oride) { | 332 | if (rpq_keywords[j].allow_oride) { |
331 | rpq_keywords[j].oride = p1-uplist+1; | 333 | rpq_keywords[j].oride = p1-uplist+1; |
332 | } else { | 334 | } else { |
333 | - rpq_warning("RPQ %s term " | ||
334 | - "override " | ||
335 | - "ignored", p1); | 335 | + rpq_warning(hSession, _("RPQ %s term override ignored"), p1); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | break; | 338 | break; |
@@ -344,8 +344,7 @@ select_rpq_terms(void) | @@ -344,8 +344,7 @@ select_rpq_terms(void) | ||
344 | for (k=0; k < NS_RPQ; k++) | 344 | for (k=0; k < NS_RPQ; k++) |
345 | rpq_keywords[k].omit = is_no_form; | 345 | rpq_keywords[k].omit = is_no_form; |
346 | } else { | 346 | } else { |
347 | - rpq_warning("RPQ term \"%s\" is unrecognized", | ||
348 | - kw); | 347 | + rpq_warning(hSession,_( "RPQ term \"%s\" is unrecognized" ),kw); |
349 | } | 348 | } |
350 | } | 349 | } |
351 | } | 350 | } |
@@ -364,8 +363,10 @@ select_rpq_terms(void) | @@ -364,8 +363,10 @@ select_rpq_terms(void) | ||
364 | return False; | 363 | return False; |
365 | } | 364 | } |
366 | 365 | ||
367 | -/* Utility function used by the RPQNAMES query reply. */ | ||
368 | -static int get_rpq_timezone(void) | 366 | +/** |
367 | + * Utility function used by the RPQNAMES query reply. | ||
368 | + */ | ||
369 | +static int get_rpq_timezone(H3270 *hSession) | ||
369 | { | 370 | { |
370 | /* | 371 | /* |
371 | * Return the signed number of minutes we're offset from UTC. | 372 | * Return the signed number of minutes we're offset from UTC. |
@@ -399,7 +400,7 @@ static int get_rpq_timezone(void) | @@ -399,7 +400,7 @@ static int get_rpq_timezone(void) | ||
399 | 400 | ||
400 | x = strtol(p1, &p2, 10); | 401 | x = strtol(p1, &p2, 10); |
401 | if (errno != 0) { | 402 | if (errno != 0) { |
402 | - rpq_warning("RPQ TIMEZONE term is invalid - use +/-hhmm"); | 403 | + rpq_warning(hSession, _( "RPQ TIMEZONE term is invalid - use +/-hhmm" )); |
403 | return 4; | 404 | return 4; |
404 | } | 405 | } |
405 | if ((*p2 != '\0') && (*p2 != ':') && (!isspace(*p2))) | 406 | if ((*p2 != '\0') && (*p2 != ':') && (!isspace(*p2))) |
@@ -408,7 +409,7 @@ static int get_rpq_timezone(void) | @@ -408,7 +409,7 @@ static int get_rpq_timezone(void) | ||
408 | hhmm = ldiv(x, 100L); | 409 | hhmm = ldiv(x, 100L); |
409 | 410 | ||
410 | if (hhmm.rem > 59L) { | 411 | if (hhmm.rem > 59L) { |
411 | - rpq_warning("RPQ TIMEZONE term is invalid - use +/-hhmm"); | 412 | + rpq_warning(hSession, _("RPQ TIMEZONE term is invalid - use +/-hhmm")); |
412 | return 4; | 413 | return 4; |
413 | } | 414 | } |
414 | 415 | ||
@@ -421,14 +422,14 @@ static int get_rpq_timezone(void) | @@ -421,14 +422,14 @@ static int get_rpq_timezone(void) | ||
421 | */ | 422 | */ |
422 | if ((here = time(NULL)) == (time_t)(-1)) | 423 | if ((here = time(NULL)) == (time_t)(-1)) |
423 | { | 424 | { |
424 | - rpq_warning("RPQ: Unable to determine workstation local time"); | 425 | + rpq_warning(hSession, _("RPQ: Unable to determine workstation local time")); |
425 | return 1; | 426 | return 1; |
426 | } | 427 | } |
427 | memcpy(&here_tm, localtime(&here), sizeof(struct tm)); | 428 | memcpy(&here_tm, localtime(&here), sizeof(struct tm)); |
428 | 429 | ||
429 | if ((utc_tm = gmtime(&here)) == NULL) | 430 | if ((utc_tm = gmtime(&here)) == NULL) |
430 | { | 431 | { |
431 | - rpq_warning("RPQ: Unable to determine workstation UTC time"); | 432 | + rpq_warning(hSession, _("RPQ: Unable to determine workstation UTC time")); |
432 | return 2; | 433 | return 2; |
433 | } | 434 | } |
434 | 435 | ||
@@ -443,14 +444,13 @@ static int get_rpq_timezone(void) | @@ -443,14 +444,13 @@ static int get_rpq_timezone(void) | ||
443 | 444 | ||
444 | /* sanity check: difference cannot exceed +/- 12 hours */ | 445 | /* sanity check: difference cannot exceed +/- 12 hours */ |
445 | if (labs(delta) > 720L) | 446 | if (labs(delta) > 720L) |
446 | - rpq_warning("RPQ timezone exceeds 12 hour UTC offset"); | 447 | + rpq_warning(hSession, _("RPQ timezone exceeds 12 hour UTC offset")); |
447 | return (labs(delta) > 720L)? 3 : (int) delta; | 448 | return (labs(delta) > 720L)? 3 : (int) delta; |
448 | } | 449 | } |
449 | 450 | ||
450 | 451 | ||
451 | /* Utility function used by the RPQNAMES query reply. */ | 452 | /* Utility function used by the RPQNAMES query reply. */ |
452 | -static int | ||
453 | -get_rpq_user(unsigned char buf[], const int buflen) | 453 | +static int get_rpq_user(H3270 *hSession, unsigned char buf[], const int buflen) |
454 | { | 454 | { |
455 | /* | 455 | /* |
456 | * Text may be specified in one of two ways, but not both. | 456 | * Text may be specified in one of two ways, but not both. |
@@ -498,13 +498,13 @@ get_rpq_user(unsigned char buf[], const int buflen) | @@ -498,13 +498,13 @@ get_rpq_user(unsigned char buf[], const int buflen) | ||
498 | if (isspace(c)) | 498 | if (isspace(c)) |
499 | continue; /* skip white space */ | 499 | continue; /* skip white space */ |
500 | if (!isxdigit(c)) { | 500 | if (!isxdigit(c)) { |
501 | - rpq_warning("RPQ USER term has non-hex character"); | 501 | + rpq_warning(hSession, _("RPQ USER term has non-hex character")); |
502 | break; | 502 | break; |
503 | } | 503 | } |
504 | x = (p_h - hexstr)/2; | 504 | x = (p_h - hexstr)/2; |
505 | if (x >= buflen) { | 505 | if (x >= buflen) { |
506 | x = buflen; | 506 | x = buflen; |
507 | - rpq_warning("RPQ USER term truncated after %d bytes", x); | 507 | + rpq_warning(hSession, _("RPQ USER term truncated after %d bytes"), x); |
508 | break; /* too long, truncate */ | 508 | break; /* too long, truncate */ |
509 | } | 509 | } |
510 | 510 | ||
@@ -523,7 +523,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | @@ -523,7 +523,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | ||
523 | */ | 523 | */ |
524 | is_first_hex_digit = ((strlen(hexstr) % 2) == 0); | 524 | is_first_hex_digit = ((strlen(hexstr) % 2) == 0); |
525 | if (!is_first_hex_digit) | 525 | if (!is_first_hex_digit) |
526 | - rpq_warning("RPQ USER term has odd number of hex digits"); | 526 | + rpq_warning(hSession, _("RPQ USER term has odd number of hex digits")); |
527 | *buf = 0; /* initialize first byte for possible implied | 527 | *buf = 0; /* initialize first byte for possible implied |
528 | leading zero */ | 528 | leading zero */ |
529 | for (p_h = &hexstr[0]; *p_h; p_h++) { | 529 | for (p_h = &hexstr[0]; *p_h; p_h++) { |
@@ -548,7 +548,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | @@ -548,7 +548,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | ||
548 | 548 | ||
549 | if ( x >= buflen) { | 549 | if ( x >= buflen) { |
550 | x = buflen; | 550 | x = buflen; |
551 | - rpq_warning("RPQ USER term truncated after %d characters", x); | 551 | + rpq_warning(hSession, _("RPQ USER term truncated after %d characters"), x); |
552 | break; | 552 | break; |
553 | } | 553 | } |
554 | 554 | ||
@@ -566,14 +566,13 @@ get_rpq_user(unsigned char buf[], const int buflen) | @@ -566,14 +566,13 @@ get_rpq_user(unsigned char buf[], const int buflen) | ||
566 | } | 566 | } |
567 | 567 | ||
568 | #if !defined(_WIN32) /*[*/ | 568 | #if !defined(_WIN32) /*[*/ |
569 | -static int | ||
570 | -get_rpq_address(unsigned char *buf, const int maxlen) | 569 | +static int get_rpq_address(H3270 *hSession, unsigned char *buf, const int maxlen) |
571 | { | 570 | { |
572 | struct rpq_keyword *kw; | 571 | struct rpq_keyword *kw; |
573 | int x = 0; | 572 | int x = 0; |
574 | 573 | ||
575 | if (maxlen < 2) { | 574 | if (maxlen < 2) { |
576 | - omit_due_space_limit = True; | 575 | + hSession->omit_due_space_limit = 1; |
577 | return 0; | 576 | return 0; |
578 | } | 577 | } |
579 | 578 | ||
@@ -622,7 +621,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -622,7 +621,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
622 | len = sizeof(struct in6_addr); | 621 | len = sizeof(struct in6_addr); |
623 | break; | 622 | break; |
624 | default: | 623 | default: |
625 | - rpq_warning("RPQ ADDRESS term has unrecognized family %u",res->ai_family); | 624 | + rpq_warning(hSession, _("RPQ ADDRESS term has unrecognized family %u"),res->ai_family); |
626 | break; | 625 | break; |
627 | } | 626 | } |
628 | 627 | ||
@@ -630,12 +629,12 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -630,12 +629,12 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
630 | x += len; | 629 | x += len; |
631 | (void) memcpy(buf, src, len); | 630 | (void) memcpy(buf, src, len); |
632 | } else { | 631 | } else { |
633 | - rpq_warning("RPQ ADDRESS term incomplete due to space limit"); | 632 | + rpq_warning(hSession, _("RPQ ADDRESS term incomplete due to space limit")); |
634 | } | 633 | } |
635 | /* Give back storage obtained by getaddrinfo */ | 634 | /* Give back storage obtained by getaddrinfo */ |
636 | freeaddrinfo(res); | 635 | freeaddrinfo(res); |
637 | } else { | 636 | } else { |
638 | - rpq_warning("RPQ: can't resolve '%s': %s",rpqtext, gai_strerror(ga_err)); | 637 | + rpq_warning(hSession, _("RPQ: can't resolve '%s': %s"),rpqtext, gai_strerror(ga_err)); |
639 | } | 638 | } |
640 | #else /*][*/ | 639 | #else /*][*/ |
641 | /* | 640 | /* |
@@ -648,7 +647,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -648,7 +647,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
648 | 647 | ||
649 | h = gethostbyname(rpqtext); | 648 | h = gethostbyname(rpqtext); |
650 | if (h == NULL || h->h_addrtype != AF_INET) { | 649 | if (h == NULL || h->h_addrtype != AF_INET) { |
651 | - rpq_warning("RPQ: gethostbyname error"); | 650 | + rpq_warning(hSession, _("RPQ: gethostbyname error")); |
652 | return 0; | 651 | return 0; |
653 | } | 652 | } |
654 | (void) memcpy(&ia, h->h_addr_list[0], h->h_length); | 653 | (void) memcpy(&ia, h->h_addr_list[0], h->h_length); |
@@ -659,7 +658,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -659,7 +658,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
659 | (void) memcpy(buf, &ia, sizeof(in_addr_t)); | 658 | (void) memcpy(buf, &ia, sizeof(in_addr_t)); |
660 | x += sizeof(in_addr_t); | 659 | x += sizeof(in_addr_t); |
661 | } else { | 660 | } else { |
662 | - rpq_warning("RPQ ADDRESS term incomplete due to space limit"); | 661 | + rpq_warning(hSession, _("RPQ ADDRESS term incomplete due to space limit")); |
663 | } | 662 | } |
664 | #endif // HAVE_GETADDRINFO | 663 | #endif // HAVE_GETADDRINFO |
665 | free(rpqtext); | 664 | free(rpqtext); |
@@ -676,7 +675,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -676,7 +675,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
676 | void *src = NULL; | 675 | void *src = NULL; |
677 | int len = 0; | 676 | int len = 0; |
678 | 677 | ||
679 | - if(net_getsockname(&h3270, &u, &addrlen) < 0) | 678 | + if(net_getsockname(hSession, &u, &addrlen) < 0) |
680 | return 0; | 679 | return 0; |
681 | SET16(buf, u.sa.sa_family); | 680 | SET16(buf, u.sa.sa_family); |
682 | x += 2; | 681 | x += 2; |
@@ -692,14 +691,14 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -692,14 +691,14 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
692 | break; | 691 | break; |
693 | #endif // HAVE_GETADDRINFO | 692 | #endif // HAVE_GETADDRINFO |
694 | default: | 693 | default: |
695 | - rpq_warning("RPQ ADDRESS term has unrecognized family %u", u.sa.sa_family); | 694 | + rpq_warning(hSession, _("RPQ ADDRESS term has unrecognized family %u"), u.sa.sa_family); |
696 | break; | 695 | break; |
697 | } | 696 | } |
698 | if (x + len <= maxlen) { | 697 | if (x + len <= maxlen) { |
699 | (void) memcpy(buf, src, len); | 698 | (void) memcpy(buf, src, len); |
700 | x += len; | 699 | x += len; |
701 | } else { | 700 | } else { |
702 | - rpq_warning("RPQ ADDRESS term incomplete due to space limit"); | 701 | + rpq_warning(hSession, _("RPQ ADDRESS term incomplete due to space limit")); |
703 | } | 702 | } |
704 | } | 703 | } |
705 | return x; | 704 | return x; |
@@ -707,51 +706,51 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -707,51 +706,51 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
707 | #endif /*]*/ | 706 | #endif /*]*/ |
708 | 707 | ||
709 | #define RPQ_WARNBUF_SIZE 1024 | 708 | #define RPQ_WARNBUF_SIZE 1024 |
710 | -static char * rpq_warnbuf = CN; | ||
711 | -static int rpq_wbcnt = 0; | 709 | +//static char * rpq_warnbuf = CN; |
710 | +//static int rpq_wbcnt = 0; | ||
712 | 711 | ||
713 | -static void rpq_warning(const char *fmt, ...) | 712 | +static void rpq_warning(H3270 *hSession, const char *fmt, ...) |
714 | { | 713 | { |
715 | va_list a; | 714 | va_list a; |
716 | 715 | ||
717 | va_start(a, fmt); | 716 | va_start(a, fmt); |
718 | - lib3270_write_va_log(&h3270,"RPQ",fmt,a); | 717 | + lib3270_write_va_log(hSession,"RPQ",fmt,a); |
719 | va_end(a); | 718 | va_end(a); |
720 | 719 | ||
721 | /* | 720 | /* |
722 | * Only accumulate RPQ warnings if they | 721 | * Only accumulate RPQ warnings if they |
723 | * have not been displayed already. | 722 | * have not been displayed already. |
724 | */ | 723 | */ |
725 | - if (!rpq_complained) | 724 | + if (!hSession->rpq_complained) |
726 | { | 725 | { |
727 | va_start(a, fmt); | 726 | va_start(a, fmt); |
728 | - if (rpq_warnbuf == CN) | ||
729 | - rpq_warnbuf = lib3270_malloc(RPQ_WARNBUF_SIZE); | 727 | + if (hSession->rpq_warnbuf == CN) |
728 | + hSession->rpq_warnbuf = lib3270_malloc(RPQ_WARNBUF_SIZE); | ||
730 | 729 | ||
731 | - if (rpq_wbcnt < RPQ_WARNBUF_SIZE) | 730 | + if (hSession->rpq_wbcnt < RPQ_WARNBUF_SIZE) |
732 | { | 731 | { |
733 | - *(rpq_warnbuf + rpq_wbcnt++) = '\n'; | ||
734 | - *(rpq_warnbuf + rpq_wbcnt) = '\0'; | 732 | + *(hSession->rpq_warnbuf + hSession->rpq_wbcnt++) = '\n'; |
733 | + *(hSession->rpq_warnbuf + hSession->rpq_wbcnt) = '\0'; | ||
735 | } | 734 | } |
736 | 735 | ||
737 | - if (rpq_wbcnt < RPQ_WARNBUF_SIZE) | 736 | + if (hSession->rpq_wbcnt < RPQ_WARNBUF_SIZE) |
738 | { | 737 | { |
739 | - rpq_wbcnt += vsnprintf(rpq_warnbuf + rpq_wbcnt,RPQ_WARNBUF_SIZE - rpq_wbcnt, fmt, a); | 738 | + hSession->rpq_wbcnt += vsnprintf(hSession->rpq_warnbuf + hSession->rpq_wbcnt,RPQ_WARNBUF_SIZE - hSession->rpq_wbcnt, fmt, a); |
740 | } | 739 | } |
741 | va_end(a); | 740 | va_end(a); |
742 | } | 741 | } |
743 | } | 742 | } |
744 | 743 | ||
745 | -static void rpq_dump_warnings(void) | 744 | +static void rpq_dump_warnings(H3270 *hSession) |
746 | { | 745 | { |
747 | /* If there's something to complain about, only complain once. */ | 746 | /* If there's something to complain about, only complain once. */ |
748 | - if (!rpq_complained && rpq_wbcnt) | 747 | + if (!hSession->rpq_complained && hSession->rpq_wbcnt) |
749 | { | 748 | { |
750 | - popup_an_error(NULL,rpq_warnbuf); | ||
751 | - rpq_wbcnt = 0; | ||
752 | - rpq_complained = True; | 749 | + popup_an_error(hSession,hSession->rpq_warnbuf); |
750 | + hSession->rpq_wbcnt = 0; | ||
751 | + hSession->rpq_complained = 1; | ||
753 | 752 | ||
754 | - free(rpq_warnbuf); | ||
755 | - rpq_warnbuf = CN; | 753 | + lib3270_free(hSession->rpq_warnbuf); |
754 | + hSession->rpq_warnbuf = CN; | ||
756 | } | 755 | } |
757 | } | 756 | } |
src/lib3270/telnet.c
@@ -2230,11 +2230,10 @@ static void cooked_init(H3270 *hSession) | @@ -2230,11 +2230,10 @@ static void cooked_init(H3270 *hSession) | ||
2230 | hSession->backslashed = 0; | 2230 | hSession->backslashed = 0; |
2231 | } | 2231 | } |
2232 | 2232 | ||
2233 | -static void | ||
2234 | -ansi_process_s(const char *data) | 2233 | +static void ansi_process_s(H3270 *hSession, const char *data) |
2235 | { | 2234 | { |
2236 | while (*data) | 2235 | while (*data) |
2237 | - ansi_process(&h3270,(unsigned int) *data++); | 2236 | + ansi_process(hSession,(unsigned int) *data++); |
2238 | } | 2237 | } |
2239 | 2238 | ||
2240 | static void forward_data(H3270 *hSession) | 2239 | static void forward_data(H3270 *hSession) |
@@ -2253,10 +2252,10 @@ static void do_data(H3270 *hSession, char c) | @@ -2253,10 +2252,10 @@ static void do_data(H3270 *hSession, char c) | ||
2253 | if (c == '\t') | 2252 | if (c == '\t') |
2254 | ansi_process(hSession,(unsigned int) c); | 2253 | ansi_process(hSession,(unsigned int) c); |
2255 | else | 2254 | else |
2256 | - ansi_process_s(ctl_see((int) c)); | 2255 | + ansi_process_s(hSession,ctl_see((int) c)); |
2257 | } | 2256 | } |
2258 | else | 2257 | else |
2259 | - ansi_process_s(""\007");07"); | 2258 | + ansi_process_s(hSession,""\007");07"); |
2260 | 2259 | ||
2261 | hSession->lnext = 0; | 2260 | hSession->lnext = 0; |
2262 | hSession->backslashed = 0; | 2261 | hSession->backslashed = 0; |
@@ -2269,7 +2268,7 @@ static void do_intr(H3270 *hSession, char c) | @@ -2269,7 +2268,7 @@ static void do_intr(H3270 *hSession, char c) | ||
2269 | do_data(hSession,c); | 2268 | do_data(hSession,c); |
2270 | return; | 2269 | return; |
2271 | } | 2270 | } |
2272 | - ansi_process_s(ctl_see((int) c)); | 2271 | + ansi_process_s(hSession,ctl_see((int) c)); |
2273 | cooked_init(hSession); | 2272 | cooked_init(hSession); |
2274 | net_interrupt(hSession); | 2273 | net_interrupt(hSession); |
2275 | } | 2274 | } |
@@ -2281,7 +2280,7 @@ static void do_quit(H3270 *hSession, char c) | @@ -2281,7 +2280,7 @@ static void do_quit(H3270 *hSession, char c) | ||
2281 | do_data(hSession,c); | 2280 | do_data(hSession,c); |
2282 | return; | 2281 | return; |
2283 | } | 2282 | } |
2284 | - ansi_process_s(ctl_see((int) c)); | 2283 | + ansi_process_s(hSession,ctl_see((int) c)); |
2285 | cooked_init(hSession); | 2284 | cooked_init(hSession); |
2286 | net_break(hSession); | 2285 | net_break(hSession); |
2287 | } | 2286 | } |
@@ -2293,7 +2292,7 @@ static void do_cerase(H3270 *hSession, char c) | @@ -2293,7 +2292,7 @@ static void do_cerase(H3270 *hSession, char c) | ||
2293 | if (hSession->backslashed) | 2292 | if (hSession->backslashed) |
2294 | { | 2293 | { |
2295 | hSession->lbptr--; | 2294 | hSession->lbptr--; |
2296 | - ansi_process_s("\b"); | 2295 | + ansi_process_s(hSession,"\b"); |
2297 | do_data(hSession,c); | 2296 | do_data(hSession,c); |
2298 | return; | 2297 | return; |
2299 | } | 2298 | } |
@@ -2309,7 +2308,7 @@ static void do_cerase(H3270 *hSession, char c) | @@ -2309,7 +2308,7 @@ static void do_cerase(H3270 *hSession, char c) | ||
2309 | len = strlen(ctl_see((int) *--hSession->lbptr)); | 2308 | len = strlen(ctl_see((int) *--hSession->lbptr)); |
2310 | 2309 | ||
2311 | while (len--) | 2310 | while (len--) |
2312 | - ansi_process_s("\b \b"); | 2311 | + ansi_process_s(hSession,"\b \b"); |
2313 | } | 2312 | } |
2314 | } | 2313 | } |
2315 | 2314 | ||
@@ -2339,7 +2338,7 @@ static void do_werase(H3270 *hSession, char c) | @@ -2339,7 +2338,7 @@ static void do_werase(H3270 *hSession, char c) | ||
2339 | len = strlen(ctl_see((int) ch)); | 2338 | len = strlen(ctl_see((int) ch)); |
2340 | 2339 | ||
2341 | while (len--) | 2340 | while (len--) |
2342 | - ansi_process_s("\b \b"); | 2341 | + ansi_process_s(hSession,"\b \b"); |
2343 | } | 2342 | } |
2344 | } | 2343 | } |
2345 | 2344 | ||
@@ -2347,9 +2346,10 @@ static void do_kill(H3270 *hSession, char c) | @@ -2347,9 +2346,10 @@ static void do_kill(H3270 *hSession, char c) | ||
2347 | { | 2346 | { |
2348 | int i, len; | 2347 | int i, len; |
2349 | 2348 | ||
2350 | - if (hSession->backslashed) { | 2349 | + if (hSession->backslashed) |
2350 | + { | ||
2351 | hSession->lbptr--; | 2351 | hSession->lbptr--; |
2352 | - ansi_process_s("\b"); | 2352 | + ansi_process_s(hSession,"\b"); |
2353 | do_data(hSession,c); | 2353 | do_data(hSession,c); |
2354 | return; | 2354 | return; |
2355 | } | 2355 | } |
@@ -2365,7 +2365,7 @@ static void do_kill(H3270 *hSession, char c) | @@ -2365,7 +2365,7 @@ static void do_kill(H3270 *hSession, char c) | ||
2365 | len = strlen(ctl_see((int) *--hSession->lbptr)); | 2365 | len = strlen(ctl_see((int) *--hSession->lbptr)); |
2366 | 2366 | ||
2367 | for (i = 0; i < len; i++) | 2367 | for (i = 0; i < len; i++) |
2368 | - ansi_process_s("\b \b"); | 2368 | + ansi_process_s(hSession,"\b \b"); |
2369 | } | 2369 | } |
2370 | } | 2370 | } |
2371 | 2371 | ||
@@ -2379,10 +2379,10 @@ static void do_rprnt(H3270 *hSession, char c) | @@ -2379,10 +2379,10 @@ static void do_rprnt(H3270 *hSession, char c) | ||
2379 | return; | 2379 | return; |
2380 | } | 2380 | } |
2381 | 2381 | ||
2382 | - ansi_process_s(ctl_see((int) c)); | ||
2383 | - ansi_process_s("\r\n"); | 2382 | + ansi_process_s(hSession,ctl_see((int) c)); |
2383 | + ansi_process_s(hSession,"\r\n"); | ||
2384 | for (p = hSession->lbuf; p < hSession->lbptr; p++) | 2384 | for (p = hSession->lbuf; p < hSession->lbptr; p++) |
2385 | - ansi_process_s(ctl_see((int) *p)); | 2385 | + ansi_process_s(hSession,ctl_see((int) *p)); |
2386 | } | 2386 | } |
2387 | 2387 | ||
2388 | static void do_eof(H3270 *hSession, char c) | 2388 | static void do_eof(H3270 *hSession, char c) |
@@ -2390,7 +2390,7 @@ static void do_eof(H3270 *hSession, char c) | @@ -2390,7 +2390,7 @@ static void do_eof(H3270 *hSession, char c) | ||
2390 | if (hSession->backslashed) | 2390 | if (hSession->backslashed) |
2391 | { | 2391 | { |
2392 | hSession->lbptr--; | 2392 | hSession->lbptr--; |
2393 | - ansi_process_s("\b"); | 2393 | + ansi_process_s(hSession,"\b"); |
2394 | do_data(hSession,c); | 2394 | do_data(hSession,c); |
2395 | return; | 2395 | return; |
2396 | } | 2396 | } |
@@ -2415,13 +2415,13 @@ static void do_eol(H3270 *hSession, char c) | @@ -2415,13 +2415,13 @@ static void do_eol(H3270 *hSession, char c) | ||
2415 | 2415 | ||
2416 | if (hSession->lbptr+2 >= hSession->lbuf + BUFSZ) | 2416 | if (hSession->lbptr+2 >= hSession->lbuf + BUFSZ) |
2417 | { | 2417 | { |
2418 | - ansi_process_s(""\007");07"); | 2418 | + ansi_process_s(hSession,""\007");07"); |
2419 | return; | 2419 | return; |
2420 | } | 2420 | } |
2421 | 2421 | ||
2422 | *hSession->lbptr++ = '\r'; | 2422 | *hSession->lbptr++ = '\r'; |
2423 | *hSession->lbptr++ = '\n'; | 2423 | *hSession->lbptr++ = '\n'; |
2424 | - ansi_process_s("\r\n"); | 2424 | + ansi_process_s(hSession,"\r\n"); |
2425 | forward_data(hSession); | 2425 | forward_data(hSession); |
2426 | } | 2426 | } |
2427 | 2427 | ||
@@ -2433,7 +2433,7 @@ static void do_lnext(H3270 *hSession, char c) | @@ -2433,7 +2433,7 @@ static void do_lnext(H3270 *hSession, char c) | ||
2433 | return; | 2433 | return; |
2434 | } | 2434 | } |
2435 | hSession->lnext = 1; | 2435 | hSession->lnext = 1; |
2436 | - ansi_process_s("^\b"); | 2436 | + ansi_process_s(hSession,"^\b"); |
2437 | } | 2437 | } |
2438 | #endif /*]*/ | 2438 | #endif /*]*/ |
2439 | 2439 |