Commit 7dde44a8f00377b204c949f8a777d2016cb3d992
1 parent
8cd61b1e
Exists in
master
and in
5 other branches
Movendo flag "linemode" para a estrutura de sessao
Showing
3 changed files
with
14 additions
and
12 deletions
Show diff stats
src/include/lib3270/session.h
src/lib3270/session.c
| @@ -198,6 +198,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -198,6 +198,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
| 198 | hSession->kybdlock = KL_NOT_CONNECTED; | 198 | hSession->kybdlock = KL_NOT_CONNECTED; |
| 199 | hSession->aid = AID_NO; | 199 | hSession->aid = AID_NO; |
| 200 | hSession->reply_mode = SF_SRM_FIELD; | 200 | hSession->reply_mode = SF_SRM_FIELD; |
| 201 | + hSession->linemode = 1; | ||
| 201 | 202 | ||
| 202 | 203 | ||
| 203 | #ifdef _WIN32 | 204 | #ifdef _WIN32 |
src/lib3270/telnet.c
| @@ -123,7 +123,7 @@ int ns_bsent; | @@ -123,7 +123,7 @@ int ns_bsent; | ||
| 123 | int ns_rsent; | 123 | int ns_rsent; |
| 124 | // unsigned char *obuf; /* 3270 output buffer */ | 124 | // unsigned char *obuf; /* 3270 output buffer */ |
| 125 | // unsigned char *obptr = (unsigned char *) NULL; | 125 | // unsigned char *obptr = (unsigned char *) NULL; |
| 126 | -int linemode = 1; | 126 | +//int linemode = 1; |
| 127 | 127 | ||
| 128 | /* | 128 | /* |
| 129 | #if defined(LOCAL_PROCESS) | 129 | #if defined(LOCAL_PROCESS) |
| @@ -1187,7 +1187,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1187,7 +1187,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
| 1187 | } | 1187 | } |
| 1188 | if (IN_NEITHER) { /* now can assume ANSI mode */ | 1188 | if (IN_NEITHER) { /* now can assume ANSI mode */ |
| 1189 | #if defined(X3270_ANSI)/*[*/ | 1189 | #if defined(X3270_ANSI)/*[*/ |
| 1190 | - if (linemode) | 1190 | + if (session->linemode) |
| 1191 | cooked_init(); | 1191 | cooked_init(); |
| 1192 | #endif /*]*/ | 1192 | #endif /*]*/ |
| 1193 | host_in3270(session,CONNECTED_ANSI); | 1193 | host_in3270(session,CONNECTED_ANSI); |
| @@ -1210,7 +1210,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1210,7 +1210,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
| 1210 | trace_dsn("%s",see_chr); | 1210 | trace_dsn("%s",see_chr); |
| 1211 | if (!session->syncing) | 1211 | if (!session->syncing) |
| 1212 | { | 1212 | { |
| 1213 | - if (linemode && session->onlcr && c == '\n') | 1213 | + if (session->linemode && session->onlcr && c == '\n') |
| 1214 | ansi_process((unsigned int) '\r'); | 1214 | ansi_process((unsigned int) '\r'); |
| 1215 | ansi_process((unsigned int) c); | 1215 | ansi_process((unsigned int) c); |
| 1216 | // sms_store(c); | 1216 | // sms_store(c); |
| @@ -2133,7 +2133,7 @@ static void net_cookout(H3270 *hSession, const char *buf, int len) | @@ -2133,7 +2133,7 @@ static void net_cookout(H3270 *hSession, const char *buf, int len) | ||
| 2133 | if (!IN_ANSI || (hSession->kybdlock & KL_AWAITING_FIRST)) | 2133 | if (!IN_ANSI || (hSession->kybdlock & KL_AWAITING_FIRST)) |
| 2134 | return; | 2134 | return; |
| 2135 | 2135 | ||
| 2136 | - if (linemode) { | 2136 | + if (hSession->linemode) { |
| 2137 | register int i; | 2137 | register int i; |
| 2138 | char c; | 2138 | char c; |
| 2139 | 2139 | ||
| @@ -2473,7 +2473,7 @@ check_in3270(H3270 *session) | @@ -2473,7 +2473,7 @@ check_in3270(H3270 *session) | ||
| 2473 | 2473 | ||
| 2474 | #if defined(X3270_ANSI) /*[*/ | 2474 | #if defined(X3270_ANSI) /*[*/ |
| 2475 | /* Reinitialize line mode. */ | 2475 | /* Reinitialize line mode. */ |
| 2476 | - if ((new_cstate == CONNECTED_ANSI && linemode) || | 2476 | + if ((new_cstate == CONNECTED_ANSI && h3270.linemode) || |
| 2477 | new_cstate == CONNECTED_NVT) | 2477 | new_cstate == CONNECTED_NVT) |
| 2478 | cooked_init(); | 2478 | cooked_init(); |
| 2479 | #endif /*]*/ | 2479 | #endif /*]*/ |
| @@ -2544,7 +2544,7 @@ void space3270out(int n) | @@ -2544,7 +2544,7 @@ void space3270out(int n) | ||
| 2544 | static void | 2544 | static void |
| 2545 | check_linemode(Boolean init) | 2545 | check_linemode(Boolean init) |
| 2546 | { | 2546 | { |
| 2547 | - int wasline = linemode; | 2547 | + int wasline = h3270.linemode; |
| 2548 | 2548 | ||
| 2549 | /* | 2549 | /* |
| 2550 | * The next line is a deliberate kluge to effectively ignore the SGA | 2550 | * The next line is a deliberate kluge to effectively ignore the SGA |
| @@ -2560,17 +2560,17 @@ check_linemode(Boolean init) | @@ -2560,17 +2560,17 @@ check_linemode(Boolean init) | ||
| 2560 | * mode" properly by asking for both SGA and ECHO to be off or on, but | 2560 | * mode" properly by asking for both SGA and ECHO to be off or on, but |
| 2561 | * we basically ignore the reply for SGA. | 2561 | * we basically ignore the reply for SGA. |
| 2562 | */ | 2562 | */ |
| 2563 | - linemode = !h3270.hisopts[TELOPT_ECHO] /* && !hisopts[TELOPT_SGA] */; | 2563 | + h3270.linemode = h3270.hisopts[TELOPT_ECHO] ? 0 : 1 /* && !hisopts[TELOPT_SGA] */; |
| 2564 | 2564 | ||
| 2565 | - if (init || linemode != wasline) | 2565 | + if (init || h3270.linemode != wasline) |
| 2566 | { | 2566 | { |
| 2567 | - st_changed(LIB3270_STATE_LINE_MODE, linemode); | 2567 | + st_changed(LIB3270_STATE_LINE_MODE, h3270.linemode); |
| 2568 | if (!init) | 2568 | if (!init) |
| 2569 | { | 2569 | { |
| 2570 | - trace_dsn("Operating in %s mode.\n",linemode ? "line" : "character-at-a-time"); | 2570 | + trace_dsn("Operating in %s mode.\n",h3270.linemode ? "line" : "character-at-a-time"); |
| 2571 | } | 2571 | } |
| 2572 | #if defined(X3270_ANSI) /*[*/ | 2572 | #if defined(X3270_ANSI) /*[*/ |
| 2573 | - if (IN_ANSI && linemode) | 2573 | + if (IN_ANSI && h3270.linemode) |
| 2574 | cooked_init(); | 2574 | cooked_init(); |
| 2575 | #endif /*]*/ | 2575 | #endif /*]*/ |
| 2576 | } | 2576 | } |
| @@ -2848,7 +2848,7 @@ net_add_eor(unsigned char *buf, int len) | @@ -2848,7 +2848,7 @@ net_add_eor(unsigned char *buf, int len) | ||
| 2848 | void | 2848 | void |
| 2849 | net_sendc(char c) | 2849 | net_sendc(char c) |
| 2850 | { | 2850 | { |
| 2851 | - if (c == '\r' && !linemode | 2851 | + if (c == '\r' && !h3270.linemode |
| 2852 | /* | 2852 | /* |
| 2853 | #if defined(LOCAL_PROCESS) | 2853 | #if defined(LOCAL_PROCESS) |
| 2854 | && !local_process | 2854 | && !local_process |