Commit 9d5150d1c409cdd859ac18ce4a3ddf69ecadbc10
1 parent
d1d71e35
Exists in
master
and in
3 other branches
Android - Iniciando implementação de suporte para script de autostart
Showing
8 changed files
with
98 additions
and
51 deletions
Show diff stats
ctlr.c
@@ -67,7 +67,8 @@ | @@ -67,7 +67,8 @@ | ||
67 | // Boolean dbcs = False; | 67 | // Boolean dbcs = False; |
68 | 68 | ||
69 | /* Statics */ | 69 | /* Statics */ |
70 | -static void set_formatted(H3270 *session); | 70 | +static void update_formatted(H3270 *session); |
71 | +static void set_formatted(H3270 *hSession, int state); | ||
71 | static void ctlr_blanks(H3270 *session); | 72 | static void ctlr_blanks(H3270 *session); |
72 | static void ctlr_half_connect(H3270 *session, int ignored, void *dunno); | 73 | static void ctlr_half_connect(H3270 *session, int ignored, void *dunno); |
73 | static void ctlr_connect(H3270 *session, int ignored, void *dunno); | 74 | static void ctlr_connect(H3270 *session, int ignored, void *dunno); |
@@ -224,37 +225,50 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) | @@ -224,37 +225,50 @@ void ctlr_set_rows_cols(H3270 *session, int mn, int ovc, int ovr) | ||
224 | 225 | ||
225 | set_viewsize(session,sz[idx].rows,sz[idx].cols); | 226 | set_viewsize(session,sz[idx].rows,sz[idx].cols); |
226 | 227 | ||
227 | - /* | ||
228 | - // Make sure that the current rows/cols are still 24x80. | ||
229 | - session->cols = 80; | ||
230 | - session->rows = 24; | ||
231 | - session->screen_alt = 0; | ||
232 | - */ | ||
233 | - | ||
234 | } | 228 | } |
235 | 229 | ||
236 | - | 230 | +static void set_formatted(H3270 *hSession, int state) |
231 | +{ | ||
232 | + hSession->formatted = state; | ||
237 | /* | 233 | /* |
238 | - * Set the formatted screen flag. A formatted screen is a screen that | ||
239 | - * has at least one field somewhere on it. | 234 | + int last = (int) hSession->formatted; |
235 | + hSession->formatted = state; | ||
236 | + | ||
237 | + if( ((int) hSession->formatted) != last) | ||
238 | + { | ||
239 | + trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); | ||
240 | + hSession->update_formatted(hSession,hSession->formatted); | ||
241 | + } | ||
242 | +*/ | ||
243 | + trace("Screen is now %s",hSession->formatted ? "formatted" : "unformatted"); | ||
244 | +} | ||
245 | + | ||
246 | +/** | ||
247 | + * Update the formatted screen flag. | ||
248 | + * | ||
249 | + * A formatted screen is a screen that has at least one field somewhere on it. | ||
250 | + * | ||
251 | + * @param hSession Session Handle | ||
240 | */ | 252 | */ |
241 | -static void set_formatted(H3270 *hSession) | 253 | +static void update_formatted(H3270 *hSession) |
242 | { | 254 | { |
243 | register int baddr; | 255 | register int baddr; |
244 | 256 | ||
245 | CHECK_SESSION_HANDLE(hSession); | 257 | CHECK_SESSION_HANDLE(hSession); |
246 | 258 | ||
247 | - hSession->formatted = False; | ||
248 | baddr = 0; | 259 | baddr = 0; |
249 | do | 260 | do |
250 | { | 261 | { |
251 | if(hSession->ea_buf[baddr].fa) | 262 | if(hSession->ea_buf[baddr].fa) |
252 | { | 263 | { |
253 | - hSession->formatted = True; | ||
254 | - break; | 264 | + set_formatted(hSession,1); |
265 | + return; | ||
255 | } | 266 | } |
256 | INC_BA(baddr); | 267 | INC_BA(baddr); |
257 | } while (baddr != 0); | 268 | } while (baddr != 0); |
269 | + | ||
270 | + set_formatted(hSession,0); | ||
271 | + | ||
258 | } | 272 | } |
259 | 273 | ||
260 | /* | 274 | /* |
@@ -277,6 +291,7 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) | @@ -277,6 +291,7 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) | ||
277 | hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY; | 291 | hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY; |
278 | else | 292 | else |
279 | hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; | 293 | hSession->ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; |
294 | + | ||
280 | if (!IN_3270 || (IN_SSCP && (hSession->kybdlock & KL_OIA_TWAIT))) | 295 | if (!IN_3270 || (IN_SSCP && (hSession->kybdlock & KL_OIA_TWAIT))) |
281 | { | 296 | { |
282 | lib3270_kybdlock_clear(hSession,KL_OIA_TWAIT); | 297 | lib3270_kybdlock_clear(hSession,KL_OIA_TWAIT); |
@@ -292,8 +307,6 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) | @@ -292,8 +307,6 @@ static void ctlr_connect(H3270 *hSession, int ignored unused, void *dunno) | ||
292 | hSession->crm_nattr = 0; | 307 | hSession->crm_nattr = 0; |
293 | } | 308 | } |
294 | 309 | ||
295 | - | ||
296 | - | ||
297 | LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr) | 310 | LIB3270_EXPORT int lib3270_field_addr(H3270 *hSession, int baddr) |
298 | { | 311 | { |
299 | int sbaddr; | 312 | int sbaddr; |
@@ -886,7 +899,8 @@ void ctlr_erase_all_unprotected(H3270 *hSession) | @@ -886,7 +899,8 @@ void ctlr_erase_all_unprotected(H3270 *hSession) | ||
886 | 899 | ||
887 | kybd_inhibit(hSession,False); | 900 | kybd_inhibit(hSession,False); |
888 | 901 | ||
889 | - if (hSession->formatted) { | 902 | + if (hSession->formatted) |
903 | + { | ||
890 | /* find first field attribute */ | 904 | /* find first field attribute */ |
891 | baddr = 0; | 905 | baddr = 0; |
892 | do { | 906 | do { |
@@ -975,7 +989,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er | @@ -975,7 +989,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er | ||
975 | ctlr_add_gr(hSession,hSession->buffer_addr, 0); \ | 989 | ctlr_add_gr(hSession,hSession->buffer_addr, 0); \ |
976 | ctlr_add_ic(hSession,hSession->buffer_addr, 0); \ | 990 | ctlr_add_ic(hSession,hSession->buffer_addr, 0); \ |
977 | trace_ds(hSession,"%s",see_attr(fa)); \ | 991 | trace_ds(hSession,"%s",see_attr(fa)); \ |
978 | - hSession->formatted = True; \ | 992 | + set_formatted(hSession,1); \ |
979 | } | 993 | } |
980 | 994 | ||
981 | kybd_inhibit(hSession,False); | 995 | kybd_inhibit(hSession,False); |
@@ -1721,7 +1735,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er | @@ -1721,7 +1735,7 @@ enum pds ctlr_write(H3270 *hSession, unsigned char buf[], int buflen, Boolean er | ||
1721 | break; | 1735 | break; |
1722 | } | 1736 | } |
1723 | } | 1737 | } |
1724 | - set_formatted(hSession); | 1738 | + update_formatted(hSession); |
1725 | END_TEXT0; | 1739 | END_TEXT0; |
1726 | trace_ds(hSession,"\n"); | 1740 | trace_ds(hSession,"\n"); |
1727 | if (wcc_keyboard_restore) { | 1741 | if (wcc_keyboard_restore) { |
@@ -2196,7 +2210,7 @@ ctlr_clear(H3270 *session, Boolean can_snap) | @@ -2196,7 +2210,7 @@ ctlr_clear(H3270 *session, Boolean can_snap) | ||
2196 | cursor_move(session,0); | 2210 | cursor_move(session,0); |
2197 | session->buffer_addr = 0; | 2211 | session->buffer_addr = 0; |
2198 | lib3270_unselect(session); | 2212 | lib3270_unselect(session); |
2199 | - session->formatted = False; | 2213 | + set_formatted(session,0); |
2200 | session->default_fg = 0; | 2214 | session->default_fg = 0; |
2201 | session->default_bg = 0; | 2215 | session->default_bg = 0; |
2202 | session->default_gr = 0; | 2216 | session->default_gr = 0; |
@@ -2225,7 +2239,7 @@ static void ctlr_blanks(H3270 *session) | @@ -2225,7 +2239,7 @@ static void ctlr_blanks(H3270 *session) | ||
2225 | cursor_move(session,0); | 2239 | cursor_move(session,0); |
2226 | session->buffer_addr = 0; | 2240 | session->buffer_addr = 0; |
2227 | lib3270_unselect(session); | 2241 | lib3270_unselect(session); |
2228 | - session->formatted = False; | 2242 | + set_formatted(session,0); |
2229 | ALL_CHANGED(session); | 2243 | ALL_CHANGED(session); |
2230 | } | 2244 | } |
2231 | 2245 |
host.c
@@ -706,7 +706,9 @@ void host_in3270(H3270 *hSession, LIB3270_CSTATE new_cstate) | @@ -706,7 +706,9 @@ void host_in3270(H3270 *hSession, LIB3270_CSTATE new_cstate) | ||
706 | 706 | ||
707 | void lib3270_set_connected(H3270 *hSession) | 707 | void lib3270_set_connected(H3270 *hSession) |
708 | { | 708 | { |
709 | - hSession->cstate = CONNECTED_INITIAL; | 709 | + hSession->cstate = CONNECTED_INITIAL; |
710 | + hSession->starting = 1; // Enable autostart | ||
711 | + | ||
710 | lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); | 712 | lib3270_st_changed(hSession, LIB3270_STATE_CONNECT, True); |
711 | if(hSession->update_connect) | 713 | if(hSession->update_connect) |
712 | hSession->update_connect(hSession,1); | 714 | hSession->update_connect(hSession,1); |
@@ -716,7 +718,9 @@ void lib3270_set_disconnected(H3270 *hSession) | @@ -716,7 +718,9 @@ void lib3270_set_disconnected(H3270 *hSession) | ||
716 | { | 718 | { |
717 | CHECK_SESSION_HANDLE(hSession); | 719 | CHECK_SESSION_HANDLE(hSession); |
718 | 720 | ||
719 | - hSession->cstate = NOT_CONNECTED; | 721 | + hSession->cstate = NOT_CONNECTED; |
722 | + hSession->starting = 0; | ||
723 | + | ||
720 | set_status(hSession,OIA_FLAG_UNDERA,False); | 724 | set_status(hSession,OIA_FLAG_UNDERA,False); |
721 | lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); | 725 | lib3270_st_changed(hSession,LIB3270_STATE_CONNECT, False); |
722 | status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); | 726 | status_changed(hSession,LIB3270_MESSAGE_DISCONNECTED); |
kybd.c
@@ -1209,7 +1209,8 @@ LIB3270_ACTION( firstfield ) | @@ -1209,7 +1209,8 @@ LIB3270_ACTION( firstfield ) | ||
1209 | return 0; | 1209 | return 0; |
1210 | } | 1210 | } |
1211 | #endif /*]*/ | 1211 | #endif /*]*/ |
1212 | - if (!hSession->formatted) { | 1212 | + if (!hSession->formatted) |
1213 | + { | ||
1213 | cursor_move(hSession,0); | 1214 | cursor_move(hSession,0); |
1214 | return 0; | 1215 | return 0; |
1215 | } | 1216 | } |
@@ -2066,8 +2067,10 @@ LIB3270_ACTION( eraseeof ) | @@ -2066,8 +2067,10 @@ LIB3270_ACTION( eraseeof ) | ||
2066 | operator_error(hSession,KL_OERR_PROTECTED); | 2067 | operator_error(hSession,KL_OERR_PROTECTED); |
2067 | return -1; | 2068 | return -1; |
2068 | } | 2069 | } |
2069 | - if (hSession->formatted) { /* erase to next field attribute */ | ||
2070 | - do { | 2070 | + if (hSession->formatted) |
2071 | + { /* erase to next field attribute */ | ||
2072 | + do | ||
2073 | + { | ||
2071 | ctlr_add(hSession,baddr, EBC_null, 0); | 2074 | ctlr_add(hSession,baddr, EBC_null, 0); |
2072 | INC_BA(baddr); | 2075 | INC_BA(baddr); |
2073 | } while (!hSession->ea_buf[baddr].fa); | 2076 | } while (!hSession->ea_buf[baddr].fa); |
@@ -2109,7 +2112,8 @@ LIB3270_ACTION( eraseinput ) | @@ -2109,7 +2112,8 @@ LIB3270_ACTION( eraseinput ) | ||
2109 | if (IN_ANSI) | 2112 | if (IN_ANSI) |
2110 | return 0; | 2113 | return 0; |
2111 | #endif /*]*/ | 2114 | #endif /*]*/ |
2112 | - if (hSession->formatted) { | 2115 | + if (hSession->formatted) |
2116 | + { | ||
2113 | /* find first field attribute */ | 2117 | /* find first field attribute */ |
2114 | baddr = 0; | 2118 | baddr = 0; |
2115 | do { | 2119 | do { |
@@ -2170,7 +2174,8 @@ LIB3270_ACTION( deleteword ) | @@ -2170,7 +2174,8 @@ LIB3270_ACTION( deleteword ) | ||
2170 | return 0; | 2174 | return 0; |
2171 | } | 2175 | } |
2172 | #if defined(X3270_ANSI) /*[*/ | 2176 | #if defined(X3270_ANSI) /*[*/ |
2173 | - if (IN_ANSI) { | 2177 | + if (IN_ANSI) |
2178 | + { | ||
2174 | net_send_werase(hSession); | 2179 | net_send_werase(hSession); |
2175 | return 0; | 2180 | return 0; |
2176 | } | 2181 | } |
@@ -2455,7 +2460,7 @@ static Boolean remargin(H3270 *hSession, int lmargin) | @@ -2455,7 +2460,7 @@ static Boolean remargin(H3270 *hSession, int lmargin) | ||
2455 | return True; | 2460 | return True; |
2456 | } | 2461 | } |
2457 | 2462 | ||
2458 | -LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int pasting) | 2463 | +LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, const char *s, int len, int pasting) |
2459 | { | 2464 | { |
2460 | enum { BASE, BACKSLASH, BACKX, BACKP, BACKPA, BACKPF, OCTAL, HEX, XGE } state = BASE; | 2465 | enum { BASE, BACKSLASH, BACKX, BACKP, BACKPA, BACKPF, OCTAL, HEX, XGE } state = BASE; |
2461 | int literal = 0; | 2466 | int literal = 0; |
@@ -2474,7 +2479,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int | @@ -2474,7 +2479,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *hSession, char *s, int len, int | ||
2474 | UChar *ws; | 2479 | UChar *ws; |
2475 | #else /*][*/ | 2480 | #else /*][*/ |
2476 | char c; | 2481 | char c; |
2477 | - char *ws; | 2482 | + const char *ws; |
2478 | #endif /*]*/ | 2483 | #endif /*]*/ |
2479 | 2484 | ||
2480 | CHECK_SESSION_HANDLE(hSession); | 2485 | CHECK_SESSION_HANDLE(hSession); |
resolver.c
@@ -183,10 +183,10 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -183,10 +183,10 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
183 | int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_len) | 183 | int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, unsigned short *pport,struct sockaddr *sa, socklen_t *sa_len, char *errmsg, int em_len) |
184 | { | 184 | { |
185 | int rc; | 185 | int rc; |
186 | - LIB3270_STATUS saved_status = hSession->oia_status; | 186 | + LIB3270_MESSAGE saved_status = hSession->oia_status; |
187 | struct parms p = { sizeof(struct parms), host, portname, pport, sa, sa_len, errmsg, em_len }; | 187 | struct parms p = { sizeof(struct parms), host, portname, pport, sa, sa_len, errmsg, em_len }; |
188 | 188 | ||
189 | - trace("Calling resolver for %s", p.host); | 189 | + trace("Calling resolver for %s status=%d", p.host, (int) saved_status); |
190 | 190 | ||
191 | status_changed(hSession,LIB3270_STATUS_RESOLVING); | 191 | status_changed(hSession,LIB3270_STATUS_RESOLVING); |
192 | hSession->cursor(hSession,CURSOR_MODE_LOCKED); | 192 | hSession->cursor(hSession,CURSOR_MODE_LOCKED); |
@@ -194,7 +194,9 @@ int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, uns | @@ -194,7 +194,9 @@ int resolve_host_and_port(H3270 *hSession, const char *host, char *portname, uns | ||
194 | rc = lib3270_call_thread((int (*)(H3270 *, void *)) cresolve_host_and_port,hSession,&p); | 194 | rc = lib3270_call_thread((int (*)(H3270 *, void *)) cresolve_host_and_port,hSession,&p); |
195 | 195 | ||
196 | hSession->cursor(hSession,CURSOR_MODE_NORMAL); | 196 | hSession->cursor(hSession,CURSOR_MODE_NORMAL); |
197 | - status_changed(hSession,saved_status); | 197 | + |
198 | + if(saved_status != -1) | ||
199 | + status_changed(hSession,saved_status); | ||
198 | 200 | ||
199 | trace("Calling resolver for %s exits with %d", p.host, rc); | 201 | trace("Calling resolver for %s exits with %d", p.host, rc); |
200 | 202 |
screen.c
@@ -372,7 +372,21 @@ void screen_update(H3270 *session, int bstart, int bend) | @@ -372,7 +372,21 @@ void screen_update(H3270 *session, int bstart, int bend) | ||
372 | session->changed(session,first,len); | 372 | session->changed(session,first,len); |
373 | } | 373 | } |
374 | 374 | ||
375 | - trace("%s ends",__FUNCTION__); | 375 | + if(session->starting && session->formatted && lib3270_in_3270(session)) |
376 | + { | ||
377 | + session->starting = 0; | ||
378 | + session->autostart(session); | ||
379 | +#ifdef DEBUG | ||
380 | + { | ||
381 | + char *text = lib3270_get_text(session,0,-1); | ||
382 | + trace("First screen:\n%s\n",text); | ||
383 | + lib3270_free(text); | ||
384 | + } | ||
385 | +#endif | ||
386 | + } | ||
387 | + | ||
388 | +// trace("%s ends",__FUNCTION__); | ||
389 | + | ||
376 | } | 390 | } |
377 | 391 | ||
378 | LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) | 392 | LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h) |
@@ -426,20 +440,20 @@ void status_ctlr_done(H3270 *session) | @@ -426,20 +440,20 @@ void status_ctlr_done(H3270 *session) | ||
426 | 440 | ||
427 | void status_oerr(H3270 *session, int error_type) | 441 | void status_oerr(H3270 *session, int error_type) |
428 | { | 442 | { |
429 | - LIB3270_STATUS sts = LIB3270_STATUS_USER; | 443 | + LIB3270_STATUS sts = LIB3270_MESSAGE_USER; |
430 | 444 | ||
431 | CHECK_SESSION_HANDLE(session); | 445 | CHECK_SESSION_HANDLE(session); |
432 | 446 | ||
433 | switch (error_type) | 447 | switch (error_type) |
434 | { | 448 | { |
435 | case KL_OERR_PROTECTED: | 449 | case KL_OERR_PROTECTED: |
436 | - sts = LIB3270_STATUS_PROTECTED; | 450 | + sts = LIB3270_MESSAGE_PROTECTED; |
437 | break; | 451 | break; |
438 | case KL_OERR_NUMERIC: | 452 | case KL_OERR_NUMERIC: |
439 | - sts = LIB3270_STATUS_NUMERIC; | 453 | + sts = LIB3270_MESSAGE_NUMERIC; |
440 | break; | 454 | break; |
441 | case KL_OERR_OVERFLOW: | 455 | case KL_OERR_OVERFLOW: |
442 | - sts = LIB3270_STATUS_OVERFLOW; | 456 | + sts = LIB3270_MESSAGE_OVERFLOW; |
443 | break; | 457 | break; |
444 | 458 | ||
445 | default: | 459 | default: |
@@ -453,9 +467,9 @@ void status_oerr(H3270 *session, int error_type) | @@ -453,9 +467,9 @@ void status_oerr(H3270 *session, int error_type) | ||
453 | void status_connecting(H3270 *session, Boolean on) | 467 | void status_connecting(H3270 *session, Boolean on) |
454 | { | 468 | { |
455 | if(session->cursor) | 469 | if(session->cursor) |
456 | - session->cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); | 470 | + session->cursor(session,on ? CURSOR_MODE_LOCKED : CURSOR_MODE_NORMAL); |
457 | 471 | ||
458 | - status_changed(session, on ? LIB3270_STATUS_CONNECTING : LIB3270_STATUS_BLANK); | 472 | + status_changed(session, on ? LIB3270_MESSAGE_CONNECTING : LIB3270_MESSAGE_NONE); |
459 | } | 473 | } |
460 | 474 | ||
461 | void status_reset(H3270 *session) | 475 | void status_reset(H3270 *session) |
@@ -464,17 +478,17 @@ void status_reset(H3270 *session) | @@ -464,17 +478,17 @@ void status_reset(H3270 *session) | ||
464 | 478 | ||
465 | if (session->kybdlock & KL_ENTER_INHIBIT) | 479 | if (session->kybdlock & KL_ENTER_INHIBIT) |
466 | { | 480 | { |
467 | - status_changed(session,LIB3270_STATUS_INHIBIT); | 481 | + status_changed(session,LIB3270_MESSAGE_INHIBIT); |
468 | } | 482 | } |
469 | else if (session->kybdlock & KL_DEFERRED_UNLOCK) | 483 | else if (session->kybdlock & KL_DEFERRED_UNLOCK) |
470 | { | 484 | { |
471 | - status_changed(session,LIB3270_STATUS_X); | 485 | + status_changed(session,LIB3270_MESSAGE_X); |
472 | } | 486 | } |
473 | else | 487 | else |
474 | { | 488 | { |
475 | if(session->cursor) | 489 | if(session->cursor) |
476 | session->cursor(session,CURSOR_MODE_NORMAL); | 490 | session->cursor(session,CURSOR_MODE_NORMAL); |
477 | - status_changed(session,LIB3270_STATUS_BLANK); | 491 | + status_changed(session,LIB3270_MESSAGE_NONE); |
478 | } | 492 | } |
479 | 493 | ||
480 | session->display(session); | 494 | session->display(session); |
@@ -503,8 +517,7 @@ void status_changed(H3270 *session, LIB3270_STATUS id) | @@ -503,8 +517,7 @@ void status_changed(H3270 *session, LIB3270_STATUS id) | ||
503 | 517 | ||
504 | session->oia_status = id; | 518 | session->oia_status = id; |
505 | 519 | ||
506 | - if(session->update_status) | ||
507 | - session->update_status(session,id); | 520 | + session->update_status(session,id); |
508 | } | 521 | } |
509 | 522 | ||
510 | void status_twait(H3270 *session) | 523 | void status_twait(H3270 *session) |
selection.c
@@ -378,7 +378,7 @@ static char * get_text(H3270 *hSession,unsigned char all) | @@ -378,7 +378,7 @@ static char * get_text(H3270 *hSession,unsigned char all) | ||
378 | size_t buflen = (hSession->rows * (hSession->cols+1))+1; | 378 | size_t buflen = (hSession->rows * (hSession->cols+1))+1; |
379 | size_t sz = 0; | 379 | size_t sz = 0; |
380 | 380 | ||
381 | - if(!lib3270_connected(hSession)) | 381 | + if(!(lib3270_connected(hSession) && hSession->text)) |
382 | return NULL; | 382 | return NULL; |
383 | 383 | ||
384 | ret = lib3270_malloc(buflen); | 384 | ret = lib3270_malloc(buflen); |
session.c
@@ -160,7 +160,7 @@ static void screen_disp(H3270 *session) | @@ -160,7 +160,7 @@ static void screen_disp(H3270 *session) | ||
160 | screen_update(session,0,session->rows*session->cols); | 160 | screen_update(session,0,session->rows*session->cols); |
161 | } | 161 | } |
162 | 162 | ||
163 | -static void set_width(H3270 *session, int width) | 163 | +static void nop_int(H3270 *session, int width) |
164 | { | 164 | { |
165 | return; | 165 | return; |
166 | } | 166 | } |
@@ -194,7 +194,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -194,7 +194,9 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
194 | hSession->message = message; | 194 | hSession->message = message; |
195 | hSession->update_ssl = update_ssl; | 195 | hSession->update_ssl = update_ssl; |
196 | hSession->display = screen_disp; | 196 | hSession->display = screen_disp; |
197 | - hSession->set_width = set_width; | 197 | + hSession->set_width = nop_int; |
198 | + hSession->update_status = (void (*)(H3270 *, LIB3270_STATUS)) nop_int; | ||
199 | + hSession->autostart = nop; | ||
198 | 200 | ||
199 | // Set the defaults. | 201 | // Set the defaults. |
200 | hSession->extended = 1; | 202 | hSession->extended = 1; |
@@ -425,7 +427,11 @@ void check_session_handle(H3270 **hSession) | @@ -425,7 +427,11 @@ void check_session_handle(H3270 **hSession) | ||
425 | 427 | ||
426 | *hSession = lib3270_get_default_session_handle(); | 428 | *hSession = lib3270_get_default_session_handle(); |
427 | 429 | ||
430 | +#ifdef ANDROID | ||
431 | + __android_log_print(ANDROID_LOG_VERBOSE, PACKAGE_NAME, "%s called with empty session\n", __FUNCTION__); | ||
432 | +#else | ||
428 | lib3270_write_log(*hSession,"%s called with empty session",__FUNCTION__); | 433 | lib3270_write_log(*hSession,"%s called with empty session",__FUNCTION__); |
434 | +#endif // ANDROID | ||
429 | } | 435 | } |
430 | 436 | ||
431 | LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) | 437 | LIB3270_EXPORT H3270 * lib3270_get_default_session_handle(void) |
telnet.c
@@ -1300,9 +1300,11 @@ static int telnet_fsm(H3270 *hSession, unsigned char c) | @@ -1300,9 +1300,11 @@ static int telnet_fsm(H3270 *hSession, unsigned char c) | ||
1300 | hSession->ns_rrcvd++; | 1300 | hSession->ns_rrcvd++; |
1301 | if (process_eor(hSession)) | 1301 | if (process_eor(hSession)) |
1302 | return -1; | 1302 | return -1; |
1303 | - } else | 1303 | + } |
1304 | + else | ||
1305 | + { | ||
1304 | Warning(hSession, _( "EOR received when not in 3270 mode, ignored." )); | 1306 | Warning(hSession, _( "EOR received when not in 3270 mode, ignored." )); |
1305 | - | 1307 | + } |
1306 | trace_dsn(hSession,"RCVD EOR\n"); | 1308 | trace_dsn(hSession,"RCVD EOR\n"); |
1307 | hSession->ibptr = hSession->ibuf; | 1309 | hSession->ibptr = hSession->ibuf; |
1308 | hSession->telnet_state = TNS_DATA; | 1310 | hSession->telnet_state = TNS_DATA; |
@@ -1900,6 +1902,7 @@ static void process_bind(H3270 *hSession, unsigned char *buf, int buflen) | @@ -1900,6 +1902,7 @@ static void process_bind(H3270 *hSession, unsigned char *buf, int buflen) | ||
1900 | static int | 1902 | static int |
1901 | process_eor(H3270 *hSession) | 1903 | process_eor(H3270 *hSession) |
1902 | { | 1904 | { |
1905 | + trace("%s: syncing=%s",__FUNCTION__,hSession->syncing ? "Yes" : "No"); | ||
1903 | if (hSession->syncing || !(hSession->ibptr - hSession->ibuf)) | 1906 | if (hSession->syncing || !(hSession->ibptr - hSession->ibuf)) |
1904 | return(0); | 1907 | return(0); |
1905 | 1908 |