Commit c7915bdffc630dfb65be0a08f2368c428f578c57
1 parent
909b81b4
Exists in
master
and in
5 other branches
Mais campos movidos para a estrutura de sessao
Showing
2 changed files
with
43 additions
and
40 deletions
Show diff stats
src/include/lib3270/session.h
src/lib3270/telnet.c
@@ -177,12 +177,12 @@ Boolean local_process = False; | @@ -177,12 +177,12 @@ Boolean local_process = False; | ||
177 | //#endif | 177 | //#endif |
178 | 178 | ||
179 | #if defined(X3270_ANSI) /*[*/ | 179 | #if defined(X3270_ANSI) /*[*/ |
180 | -static int ansi_data = 0; | 180 | +//static int ansi_data = 0; |
181 | // static unsigned char *lbuf = (unsigned char *)NULL; | 181 | // static unsigned char *lbuf = (unsigned char *)NULL; |
182 | /* line-mode input buffer */ | 182 | /* line-mode input buffer */ |
183 | // static unsigned char *lbptr; | 183 | // static unsigned char *lbptr; |
184 | -static int lnext = 0; | ||
185 | -static int backslashed = 0; | 184 | +// static int lnext = 0; |
185 | +// static int backslashed = 0; | ||
186 | static int t_valid = 0; | 186 | static int t_valid = 0; |
187 | static char vintr; | 187 | static char vintr; |
188 | static char vquit; | 188 | static char vquit; |
@@ -1007,7 +1007,7 @@ void net_input(H3270 *session) | @@ -1007,7 +1007,7 @@ void net_input(H3270 *session) | ||
1007 | */ | 1007 | */ |
1008 | 1008 | ||
1009 | #if defined(X3270_ANSI) /*[*/ | 1009 | #if defined(X3270_ANSI) /*[*/ |
1010 | - ansi_data = 0; | 1010 | + session->ansi_data = 0; |
1011 | #endif /*]*/ | 1011 | #endif /*]*/ |
1012 | 1012 | ||
1013 | #if defined(_WIN32) | 1013 | #if defined(_WIN32) |
@@ -1107,10 +1107,10 @@ void net_input(H3270 *session) | @@ -1107,10 +1107,10 @@ void net_input(H3270 *session) | ||
1107 | (void) ctlr_dbcs_postprocess(); | 1107 | (void) ctlr_dbcs_postprocess(); |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | - if (ansi_data) | 1110 | + if (session->ansi_data) |
1111 | { | 1111 | { |
1112 | trace_dsn("\n"); | 1112 | trace_dsn("\n"); |
1113 | - ansi_data = 0; | 1113 | + session->ansi_data = 0; |
1114 | } | 1114 | } |
1115 | #endif // X3270_ANSI | 1115 | #endif // X3270_ANSI |
1116 | 1116 | ||
@@ -1187,9 +1187,9 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1187,9 +1187,9 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
1187 | if (c == IAC) { /* got a telnet command */ | 1187 | if (c == IAC) { /* got a telnet command */ |
1188 | session->telnet_state = TNS_IAC; | 1188 | session->telnet_state = TNS_IAC; |
1189 | #if defined(X3270_ANSI) /*[*/ | 1189 | #if defined(X3270_ANSI) /*[*/ |
1190 | - if (ansi_data) { | 1190 | + if (session->ansi_data) { |
1191 | trace_dsn("\n"); | 1191 | trace_dsn("\n"); |
1192 | - ansi_data = 0; | 1192 | + session->ansi_data = 0; |
1193 | } | 1193 | } |
1194 | #endif /*]*/ | 1194 | #endif /*]*/ |
1195 | break; | 1195 | break; |
@@ -1206,15 +1206,15 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1206,15 +1206,15 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
1206 | } | 1206 | } |
1207 | if (IN_ANSI && !IN_E) { | 1207 | if (IN_ANSI && !IN_E) { |
1208 | #if defined(X3270_ANSI) /*[*/ | 1208 | #if defined(X3270_ANSI) /*[*/ |
1209 | - if (!ansi_data) { | 1209 | + if (!session->ansi_data) { |
1210 | trace_dsn("<.. "); | 1210 | trace_dsn("<.. "); |
1211 | - ansi_data = 4; | 1211 | + session->ansi_data = 4; |
1212 | } | 1212 | } |
1213 | see_chr = ctl_see((int) c); | 1213 | see_chr = ctl_see((int) c); |
1214 | - ansi_data += (sl = strlen(see_chr)); | ||
1215 | - if (ansi_data >= TRACELINE) { | 1214 | + session->ansi_data += (sl = strlen(see_chr)); |
1215 | + if (session->ansi_data >= TRACELINE) { | ||
1216 | trace_dsn(" ...\n... "); | 1216 | trace_dsn(" ...\n... "); |
1217 | - ansi_data = 4 + sl; | 1217 | + session->ansi_data = 4 + sl; |
1218 | } | 1218 | } |
1219 | trace_dsn("%s",see_chr); | 1219 | trace_dsn("%s",see_chr); |
1220 | if (!session->syncing) | 1220 | if (!session->syncing) |
@@ -1237,15 +1237,15 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1237,15 +1237,15 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
1237 | case IAC: /* escaped IAC, insert it */ | 1237 | case IAC: /* escaped IAC, insert it */ |
1238 | if (IN_ANSI && !IN_E) { | 1238 | if (IN_ANSI && !IN_E) { |
1239 | #if defined(X3270_ANSI) /*[*/ | 1239 | #if defined(X3270_ANSI) /*[*/ |
1240 | - if (!ansi_data) { | 1240 | + if (!session->ansi_data) { |
1241 | trace_dsn("<.. "); | 1241 | trace_dsn("<.. "); |
1242 | - ansi_data = 4; | 1242 | + session->ansi_data = 4; |
1243 | } | 1243 | } |
1244 | see_chr = ctl_see((int) c); | 1244 | see_chr = ctl_see((int) c); |
1245 | - ansi_data += (sl = strlen(see_chr)); | ||
1246 | - if (ansi_data >= TRACELINE) { | 1245 | + session->ansi_data += (sl = strlen(see_chr)); |
1246 | + if (session->ansi_data >= TRACELINE) { | ||
1247 | trace_dsn(" ...\n ..."); | 1247 | trace_dsn(" ...\n ..."); |
1248 | - ansi_data = 4 + sl; | 1248 | + session->ansi_data = 4 + sl; |
1249 | } | 1249 | } |
1250 | trace_dsn("%s",see_chr); | 1250 | trace_dsn("%s",see_chr); |
1251 | ansi_process((unsigned int) c); | 1251 | ansi_process((unsigned int) c); |
@@ -2148,16 +2148,16 @@ static void net_cookout(H3270 *hSession, const char *buf, int len) | @@ -2148,16 +2148,16 @@ static void net_cookout(H3270 *hSession, const char *buf, int len) | ||
2148 | c = buf[i]; | 2148 | c = buf[i]; |
2149 | 2149 | ||
2150 | /* Input conversions. */ | 2150 | /* Input conversions. */ |
2151 | - if (!lnext && c == '\r' && hSession->icrnl) | 2151 | + if (!hSession->lnext && c == '\r' && hSession->icrnl) |
2152 | c = '\n'; | 2152 | c = '\n'; |
2153 | - else if (!lnext && c == '\n' && hSession->inlcr) | 2153 | + else if (!hSession->lnext && c == '\n' && hSession->inlcr) |
2154 | c = '\r'; | 2154 | c = '\r'; |
2155 | 2155 | ||
2156 | /* Backslashes. */ | 2156 | /* Backslashes. */ |
2157 | - if (c == '\\' && !backslashed) | ||
2158 | - backslashed = 1; | 2157 | + if (c == '\\' && !hSession->backslashed) |
2158 | + hSession->backslashed = 1; | ||
2159 | else | 2159 | else |
2160 | - backslashed = 0; | 2160 | + hSession->backslashed = 0; |
2161 | 2161 | ||
2162 | /* Control chars. */ | 2162 | /* Control chars. */ |
2163 | if (c == '\n') | 2163 | if (c == '\n') |
@@ -2199,8 +2199,8 @@ cooked_init(void) | @@ -2199,8 +2199,8 @@ cooked_init(void) | ||
2199 | if (h3270.lbuf == (unsigned char *)NULL) | 2199 | if (h3270.lbuf == (unsigned char *)NULL) |
2200 | h3270.lbuf = (unsigned char *)lib3270_malloc(BUFSZ); | 2200 | h3270.lbuf = (unsigned char *)lib3270_malloc(BUFSZ); |
2201 | h3270.lbptr = h3270.lbuf; | 2201 | h3270.lbptr = h3270.lbuf; |
2202 | - lnext = 0; | ||
2203 | - backslashed = 0; | 2202 | + h3270.lnext = 0; |
2203 | + h3270.backslashed = 0; | ||
2204 | } | 2204 | } |
2205 | 2205 | ||
2206 | static void | 2206 | static void |
@@ -2230,14 +2230,14 @@ do_data(char c) | @@ -2230,14 +2230,14 @@ do_data(char c) | ||
2230 | ansi_process_s(ctl_see((int) c)); | 2230 | ansi_process_s(ctl_see((int) c)); |
2231 | } else | 2231 | } else |
2232 | ansi_process_s("\007"); | 2232 | ansi_process_s("\007"); |
2233 | - lnext = 0; | ||
2234 | - backslashed = 0; | 2233 | + h3270.lnext = 0; |
2234 | + h3270.backslashed = 0; | ||
2235 | } | 2235 | } |
2236 | 2236 | ||
2237 | static void | 2237 | static void |
2238 | do_intr(char c) | 2238 | do_intr(char c) |
2239 | { | 2239 | { |
2240 | - if (lnext) { | 2240 | + if (h3270.lnext) { |
2241 | do_data(c); | 2241 | do_data(c); |
2242 | return; | 2242 | return; |
2243 | } | 2243 | } |
@@ -2249,7 +2249,7 @@ do_intr(char c) | @@ -2249,7 +2249,7 @@ do_intr(char c) | ||
2249 | static void | 2249 | static void |
2250 | do_quit(char c) | 2250 | do_quit(char c) |
2251 | { | 2251 | { |
2252 | - if (lnext) { | 2252 | + if (h3270.lnext) { |
2253 | do_data(c); | 2253 | do_data(c); |
2254 | return; | 2254 | return; |
2255 | } | 2255 | } |
@@ -2263,13 +2263,13 @@ do_cerase(char c) | @@ -2263,13 +2263,13 @@ do_cerase(char c) | ||
2263 | { | 2263 | { |
2264 | int len; | 2264 | int len; |
2265 | 2265 | ||
2266 | - if (backslashed) { | 2266 | + if (h3270.backslashed) { |
2267 | h3270.lbptr--; | 2267 | h3270.lbptr--; |
2268 | ansi_process_s("\b"); | 2268 | ansi_process_s("\b"); |
2269 | do_data(c); | 2269 | do_data(c); |
2270 | return; | 2270 | return; |
2271 | } | 2271 | } |
2272 | - if (lnext) { | 2272 | + if (h3270.lnext) { |
2273 | do_data(c); | 2273 | do_data(c); |
2274 | return; | 2274 | return; |
2275 | } | 2275 | } |
@@ -2287,7 +2287,7 @@ do_werase(char c) | @@ -2287,7 +2287,7 @@ do_werase(char c) | ||
2287 | int any = 0; | 2287 | int any = 0; |
2288 | int len; | 2288 | int len; |
2289 | 2289 | ||
2290 | - if (lnext) { | 2290 | + if (h3270.lnext) { |
2291 | do_data(c); | 2291 | do_data(c); |
2292 | return; | 2292 | return; |
2293 | } | 2293 | } |
@@ -2315,13 +2315,13 @@ do_kill(char c) | @@ -2315,13 +2315,13 @@ do_kill(char c) | ||
2315 | { | 2315 | { |
2316 | int i, len; | 2316 | int i, len; |
2317 | 2317 | ||
2318 | - if (backslashed) { | 2318 | + if (h3270.backslashed) { |
2319 | h3270.lbptr--; | 2319 | h3270.lbptr--; |
2320 | ansi_process_s("\b"); | 2320 | ansi_process_s("\b"); |
2321 | do_data(c); | 2321 | do_data(c); |
2322 | return; | 2322 | return; |
2323 | } | 2323 | } |
2324 | - if (lnext) { | 2324 | + if (h3270.lnext) { |
2325 | do_data(c); | 2325 | do_data(c); |
2326 | return; | 2326 | return; |
2327 | } | 2327 | } |
@@ -2338,7 +2338,7 @@ do_rprnt(char c) | @@ -2338,7 +2338,7 @@ do_rprnt(char c) | ||
2338 | { | 2338 | { |
2339 | unsigned char *p; | 2339 | unsigned char *p; |
2340 | 2340 | ||
2341 | - if (lnext) { | 2341 | + if (h3270.lnext) { |
2342 | do_data(c); | 2342 | do_data(c); |
2343 | return; | 2343 | return; |
2344 | } | 2344 | } |
@@ -2351,13 +2351,13 @@ do_rprnt(char c) | @@ -2351,13 +2351,13 @@ do_rprnt(char c) | ||
2351 | static void | 2351 | static void |
2352 | do_eof(char c) | 2352 | do_eof(char c) |
2353 | { | 2353 | { |
2354 | - if (backslashed) { | 2354 | + if (h3270.backslashed) { |
2355 | h3270.lbptr--; | 2355 | h3270.lbptr--; |
2356 | ansi_process_s("\b"); | 2356 | ansi_process_s("\b"); |
2357 | do_data(c); | 2357 | do_data(c); |
2358 | return; | 2358 | return; |
2359 | } | 2359 | } |
2360 | - if (lnext) { | 2360 | + if (h3270.lnext) { |
2361 | do_data(c); | 2361 | do_data(c); |
2362 | return; | 2362 | return; |
2363 | } | 2363 | } |
@@ -2368,7 +2368,7 @@ do_eof(char c) | @@ -2368,7 +2368,7 @@ do_eof(char c) | ||
2368 | static void | 2368 | static void |
2369 | do_eol(char c) | 2369 | do_eol(char c) |
2370 | { | 2370 | { |
2371 | - if (lnext) { | 2371 | + if (h3270.lnext) { |
2372 | do_data(c); | 2372 | do_data(c); |
2373 | return; | 2373 | return; |
2374 | } | 2374 | } |
@@ -2385,11 +2385,11 @@ do_eol(char c) | @@ -2385,11 +2385,11 @@ do_eol(char c) | ||
2385 | static void | 2385 | static void |
2386 | do_lnext(char c) | 2386 | do_lnext(char c) |
2387 | { | 2387 | { |
2388 | - if (lnext) { | 2388 | + if (h3270.lnext) { |
2389 | do_data(c); | 2389 | do_data(c); |
2390 | return; | 2390 | return; |
2391 | } | 2391 | } |
2392 | - lnext = 1; | 2392 | + h3270.lnext = 1; |
2393 | ansi_process_s("^\b"); | 2393 | ansi_process_s("^\b"); |
2394 | } | 2394 | } |
2395 | #endif /*]*/ | 2395 | #endif /*]*/ |