Commit 7492b29e9f69491f398b08c5ab44d032be46701c
1 parent
ed2e112b
Exists in
master
and in
5 other branches
Incluindo suporte multi-sessão em mais funções
Showing
7 changed files
with
96 additions
and
301 deletions
Show diff stats
src/lib3270/ansi.c
| @@ -1312,11 +1312,10 @@ ansi_reverse_index(H3270 *hSession, int ig1 unused, int ig2 unused) | @@ -1312,11 +1312,10 @@ ansi_reverse_index(H3270 *hSession, int ig1 unused, int ig2 unused) | ||
| 1312 | return DATA; | 1312 | return DATA; |
| 1313 | } | 1313 | } |
| 1314 | 1314 | ||
| 1315 | -static enum lib3270_ansi_state | ||
| 1316 | -ansi_send_attributes(H3270 *hSession, int nn, int ig2 unused) | 1315 | +static enum lib3270_ansi_state ansi_send_attributes(H3270 *hSession, int nn, int ig2 unused) |
| 1317 | { | 1316 | { |
| 1318 | if (!nn) | 1317 | if (!nn) |
| 1319 | - net_sends(""\033[?1;2c");33[?1;2c"); | 1318 | + net_sends(hSession,""\033[?1;2c");33[?1;2c"); |
| 1320 | return DATA; | 1319 | return DATA; |
| 1321 | } | 1320 | } |
| 1322 | 1321 | ||
| @@ -1361,14 +1360,15 @@ ansi_status_report(H3270 *hSession, int nn, int ig2 unused) | @@ -1361,14 +1360,15 @@ ansi_status_report(H3270 *hSession, int nn, int ig2 unused) | ||
| 1361 | { | 1360 | { |
| 1362 | static char cpr[11]; | 1361 | static char cpr[11]; |
| 1363 | 1362 | ||
| 1364 | - switch (nn) { | ||
| 1365 | - case 5: | ||
| 1366 | - net_sends("\033[0n"); | 1363 | + switch (nn) |
| 1364 | + { | ||
| 1365 | + case 5: | ||
| 1366 | + net_sends(hSession,"\033[0n"); | ||
| 1367 | break; | 1367 | break; |
| 1368 | - case 6: | ||
| 1369 | - (void) sprintf(cpr, "\033[%d;%dR", | ||
| 1370 | - (hSession->cursor_addr/hSession->cols) + 1, (hSession->cursor_addr%hSession->cols) + 1); | ||
| 1371 | - net_sends(cpr); | 1368 | + |
| 1369 | + case 6: | ||
| 1370 | + (void) sprintf(cpr, "\033[%d;%dR",(hSession->cursor_addr/hSession->cols) + 1, (hSession->cursor_addr%hSession->cols) + 1); | ||
| 1371 | + net_sends(hSession,cpr); | ||
| 1372 | break; | 1372 | break; |
| 1373 | } | 1373 | } |
| 1374 | return DATA; | 1374 | return DATA; |
| @@ -1771,48 +1771,48 @@ void | @@ -1771,48 +1771,48 @@ void | ||
| 1771 | ansi_send_up(H3270 *hSession) | 1771 | ansi_send_up(H3270 *hSession) |
| 1772 | { | 1772 | { |
| 1773 | if (hSession->appl_cursor) | 1773 | if (hSession->appl_cursor) |
| 1774 | - net_sends(""\033OA");33OA"); | 1774 | + net_sends(hSession,""\033OA");33OA"); |
| 1775 | else | 1775 | else |
| 1776 | - net_sends(""\033[A");33[A"); | 1776 | + net_sends(hSession,""\033[A");33[A"); |
| 1777 | } | 1777 | } |
| 1778 | 1778 | ||
| 1779 | void | 1779 | void |
| 1780 | ansi_send_down(H3270 *hSession) | 1780 | ansi_send_down(H3270 *hSession) |
| 1781 | { | 1781 | { |
| 1782 | if (hSession->appl_cursor) | 1782 | if (hSession->appl_cursor) |
| 1783 | - net_sends(""\033OB");33OB"); | 1783 | + net_sends(hSession,""\033OB");33OB"); |
| 1784 | else | 1784 | else |
| 1785 | - net_sends(""\033[B");33[B"); | 1785 | + net_sends(hSession,""\033[B");33[B"); |
| 1786 | } | 1786 | } |
| 1787 | 1787 | ||
| 1788 | void | 1788 | void |
| 1789 | ansi_send_right(H3270 *hSession) | 1789 | ansi_send_right(H3270 *hSession) |
| 1790 | { | 1790 | { |
| 1791 | if (hSession->appl_cursor) | 1791 | if (hSession->appl_cursor) |
| 1792 | - net_sends(""\033OC");33OC"); | 1792 | + net_sends(hSession,""\033OC");33OC"); |
| 1793 | else | 1793 | else |
| 1794 | - net_sends(""\033[C");33[C"); | 1794 | + net_sends(hSession,""\033[C");33[C"); |
| 1795 | } | 1795 | } |
| 1796 | 1796 | ||
| 1797 | void | 1797 | void |
| 1798 | ansi_send_left(H3270 *hSession) | 1798 | ansi_send_left(H3270 *hSession) |
| 1799 | { | 1799 | { |
| 1800 | if (hSession->appl_cursor) | 1800 | if (hSession->appl_cursor) |
| 1801 | - net_sends(""\033OD");33OD"); | 1801 | + net_sends(hSession,""\033OD");33OD"); |
| 1802 | else | 1802 | else |
| 1803 | - net_sends(""\033[D");33[D"); | 1803 | + net_sends(hSession,""\033[D");33[D"); |
| 1804 | } | 1804 | } |
| 1805 | 1805 | ||
| 1806 | void | 1806 | void |
| 1807 | ansi_send_home(H3270 *hSession) | 1807 | ansi_send_home(H3270 *hSession) |
| 1808 | { | 1808 | { |
| 1809 | - net_sends(""\033[H");33[H"); | 1809 | + net_sends(hSession,""\033[H");33[H"); |
| 1810 | } | 1810 | } |
| 1811 | 1811 | ||
| 1812 | void | 1812 | void |
| 1813 | ansi_send_clear(H3270 *hSession) | 1813 | ansi_send_clear(H3270 *hSession) |
| 1814 | { | 1814 | { |
| 1815 | - net_sends(""\033[2K");33[2K"); | 1815 | + net_sends(hSession,""\033[2K");33[2K"); |
| 1816 | } | 1816 | } |
| 1817 | 1817 | ||
| 1818 | void | 1818 | void |
| @@ -1838,7 +1838,7 @@ ansi_send_pf(H3270 *hSession, int nn) | @@ -1838,7 +1838,7 @@ ansi_send_pf(H3270 *hSession, int nn) | ||
| 1838 | if (nn < 1 || nn > sizeof(code)/sizeof(code[0])) | 1838 | if (nn < 1 || nn > sizeof(code)/sizeof(code[0])) |
| 1839 | return; | 1839 | return; |
| 1840 | (void) sprintf(fn_buf, "\033[%d~", code[nn-1]); | 1840 | (void) sprintf(fn_buf, "\033[%d~", code[nn-1]); |
| 1841 | - net_sends(fn_buf); | 1841 | + net_sends(hSession,fn_buf); |
| 1842 | } | 1842 | } |
| 1843 | 1843 | ||
| 1844 | void | 1844 | void |
| @@ -1850,7 +1850,7 @@ ansi_send_pa(H3270 *hSession, int nn) | @@ -1850,7 +1850,7 @@ ansi_send_pa(H3270 *hSession, int nn) | ||
| 1850 | if (nn < 1 || nn > 4) | 1850 | if (nn < 1 || nn > 4) |
| 1851 | return; | 1851 | return; |
| 1852 | (void) sprintf(fn_buf, "\033O%c", code[nn-1]); | 1852 | (void) sprintf(fn_buf, "\033O%c", code[nn-1]); |
| 1853 | - net_sends(fn_buf); | 1853 | + net_sends(hSession,fn_buf); |
| 1854 | } | 1854 | } |
| 1855 | 1855 | ||
| 1856 | void toggle_lineWrap(H3270 *hSession, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type unused) | 1856 | void toggle_lineWrap(H3270 *hSession, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type unused) |
src/lib3270/ctlr.c
| @@ -353,53 +353,6 @@ unsigned char get_field_attribute(H3270 *h, int baddr) | @@ -353,53 +353,6 @@ unsigned char get_field_attribute(H3270 *h, int baddr) | ||
| 353 | } | 353 | } |
| 354 | 354 | ||
| 355 | /* | 355 | /* |
| 356 | - * Find the field attribute for the given buffer address, bounded by another | ||
| 357 | - * buffer address. Return the attribute in a parameter. | ||
| 358 | - * | ||
| 359 | - * Returns True if an attribute is found, False if boundary hit. | ||
| 360 | - */ /* | ||
| 361 | -Boolean | ||
| 362 | -get_bounded_field_attribute(register int baddr, register int bound, | ||
| 363 | - unsigned char *fa_out) | ||
| 364 | -{ | ||
| 365 | - int sbaddr; | ||
| 366 | - | ||
| 367 | - if (!h3270.formatted) { | ||
| 368 | - *fa_out = h3270.ea_buf[-1].fa; | ||
| 369 | - return True; | ||
| 370 | - } | ||
| 371 | - | ||
| 372 | - sbaddr = baddr; | ||
| 373 | - do { | ||
| 374 | - if (h3270.ea_buf[baddr].fa) { | ||
| 375 | - *fa_out = h3270.ea_buf[baddr].fa; | ||
| 376 | - return True; | ||
| 377 | - } | ||
| 378 | - DEC_BA(baddr); | ||
| 379 | - } while (baddr != sbaddr && baddr != bound); | ||
| 380 | - | ||
| 381 | - // Screen is unformatted (and 'formatted' is inaccurate). | ||
| 382 | - if (baddr == sbaddr) { | ||
| 383 | - *fa_out = h3270.ea_buf[-1].fa; | ||
| 384 | - return True; | ||
| 385 | - } | ||
| 386 | - | ||
| 387 | - // Wrapped to boundary. | ||
| 388 | - return False; | ||
| 389 | -} */ | ||
| 390 | - | ||
| 391 | -/* | ||
| 392 | - * Given the address of a field attribute, return the address of the | ||
| 393 | - * extended attribute structure. | ||
| 394 | - */ /* | ||
| 395 | -struct ea * | ||
| 396 | -fa2ea(int baddr) | ||
| 397 | -{ | ||
| 398 | - return &h3270.ea_buf[baddr]; | ||
| 399 | -} | ||
| 400 | -*/ | ||
| 401 | - | ||
| 402 | -/* | ||
| 403 | * Find the next unprotected field. Returns the address following the | 356 | * Find the next unprotected field. Returns the address following the |
| 404 | * unprotected attribute byte, or 0 if no nonzero-width unprotected field | 357 | * unprotected attribute byte, or 0 if no nonzero-width unprotected field |
| 405 | * can be found. | 358 | * can be found. |
| @@ -517,14 +470,14 @@ enum pds process_ds(H3270 *hSession, unsigned char *buf, int buflen) | @@ -517,14 +470,14 @@ enum pds process_ds(H3270 *hSession, unsigned char *buf, int buflen) | ||
| 517 | case CMD_RM: /* read modifed */ | 470 | case CMD_RM: /* read modifed */ |
| 518 | case SNA_CMD_RM: | 471 | case SNA_CMD_RM: |
| 519 | trace_ds(hSession,"ReadModified\n"); | 472 | trace_ds(hSession,"ReadModified\n"); |
| 520 | - ctlr_read_modified(hSession->aid, False); | 473 | + ctlr_read_modified(hSession, hSession->aid, False); |
| 521 | return PDS_OKAY_OUTPUT; | 474 | return PDS_OKAY_OUTPUT; |
| 522 | break; | 475 | break; |
| 523 | 476 | ||
| 524 | case CMD_RMA: /* read modifed all */ | 477 | case CMD_RMA: /* read modifed all */ |
| 525 | case SNA_CMD_RMA: | 478 | case SNA_CMD_RMA: |
| 526 | trace_ds(hSession,"ReadModifiedAll\n"); | 479 | trace_ds(hSession,"ReadModifiedAll\n"); |
| 527 | - ctlr_read_modified(hSession->aid, True); | 480 | + ctlr_read_modified(hSession, hSession->aid, True); |
| 528 | return PDS_OKAY_OUTPUT; | 481 | return PDS_OKAY_OUTPUT; |
| 529 | break; | 482 | break; |
| 530 | 483 | ||
| @@ -609,12 +562,10 @@ static void insert_sa(H3270 *hSession, int baddr, unsigned char *current_fgp, un | @@ -609,12 +562,10 @@ static void insert_sa(H3270 *hSession, int baddr, unsigned char *current_fgp, un | ||
| 609 | } | 562 | } |
| 610 | 563 | ||
| 611 | 564 | ||
| 612 | -/* | ||
| 613 | - * Process a 3270 Read-Modified command and transmit the data back to the | ||
| 614 | - * host. | 565 | +/** |
| 566 | + * Process a 3270 Read-Modified command and transmit the data back to the host. | ||
| 615 | */ | 567 | */ |
| 616 | -void | ||
| 617 | -ctlr_read_modified(unsigned char aid_byte, Boolean all) | 568 | +void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all) |
| 618 | { | 569 | { |
| 619 | register int baddr, sbaddr; | 570 | register int baddr, sbaddr; |
| 620 | Boolean send_data = True; | 571 | Boolean send_data = True; |
src/lib3270/ctlrc.h
| @@ -54,7 +54,7 @@ LIB3270_INTERNAL void ctlr_clear(H3270 *hSession, Boolean can_snap); | @@ -54,7 +54,7 @@ LIB3270_INTERNAL void ctlr_clear(H3270 *hSession, Boolean can_snap); | ||
| 54 | LIB3270_INTERNAL void ctlr_erase_all_unprotected(H3270 *hSession); | 54 | LIB3270_INTERNAL void ctlr_erase_all_unprotected(H3270 *hSession); |
| 55 | LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask); | 55 | LIB3270_INTERNAL void ctlr_init(H3270 *session, unsigned cmask); |
| 56 | LIB3270_INTERNAL void ctlr_read_buffer(H3270 *session, unsigned char aid_byte); | 56 | LIB3270_INTERNAL void ctlr_read_buffer(H3270 *session, unsigned char aid_byte); |
| 57 | -LIB3270_INTERNAL void ctlr_read_modified(unsigned char aid_byte, Boolean all); | 57 | +LIB3270_INTERNAL void ctlr_read_modified(H3270 *hSession, unsigned char aid_byte, Boolean all); |
| 58 | LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask); | 58 | LIB3270_INTERNAL void ctlr_reinit(H3270 *session, unsigned cmask); |
| 59 | LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession); | 59 | LIB3270_INTERNAL void ctlr_scroll(H3270 *hSession); |
| 60 | // LIB3270_INTERNAL void ctlr_shrink(void); | 60 | // LIB3270_INTERNAL void ctlr_shrink(void); |
src/lib3270/kybd.c
| @@ -502,7 +502,7 @@ static void key_AID(H3270 *hSession, unsigned char aid_code) | @@ -502,7 +502,7 @@ static void key_AID(H3270 *hSession, unsigned char aid_code) | ||
| 502 | trace("aid_code: %02x IN_ANSI: %d",aid_code,IN_ANSI); | 502 | trace("aid_code: %02x IN_ANSI: %d",aid_code,IN_ANSI); |
| 503 | 503 | ||
| 504 | if (aid_code == AID_ENTER) { | 504 | if (aid_code == AID_ENTER) { |
| 505 | - net_sendc('\r'); | 505 | + net_sendc(hSession, '\r'); |
| 506 | return; | 506 | return; |
| 507 | } | 507 | } |
| 508 | for (i = 0; i < PF_SZ; i++) | 508 | for (i = 0; i < PF_SZ; i++) |
| @@ -551,7 +551,7 @@ static void key_AID(H3270 *hSession, unsigned char aid_code) | @@ -551,7 +551,7 @@ static void key_AID(H3270 *hSession, unsigned char aid_code) | ||
| 551 | kybdlock_set(hSession,KL_OIA_TWAIT | KL_OIA_LOCKED); | 551 | kybdlock_set(hSession,KL_OIA_TWAIT | KL_OIA_LOCKED); |
| 552 | } | 552 | } |
| 553 | hSession->aid = aid_code; | 553 | hSession->aid = aid_code; |
| 554 | - ctlr_read_modified(hSession->aid, False); | 554 | + ctlr_read_modified(hSession, hSession->aid, False); |
| 555 | ticking_start(hSession,False); | 555 | ticking_start(hSession,False); |
| 556 | status_ctlr_done(hSession); | 556 | status_ctlr_done(hSession); |
| 557 | } | 557 | } |
| @@ -990,7 +990,7 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo | @@ -990,7 +990,7 @@ void key_ACharacter(unsigned char c, enum keytype keytype, enum iaction cause,Bo | ||
| 990 | #if defined(X3270_ANSI) /*[*/ | 990 | #if defined(X3270_ANSI) /*[*/ |
| 991 | else if (IN_ANSI) | 991 | else if (IN_ANSI) |
| 992 | { | 992 | { |
| 993 | - net_sendc((char) c); | 993 | + net_sendc(&h3270,(char) c); |
| 994 | } | 994 | } |
| 995 | #endif /*]*/ | 995 | #endif /*]*/ |
| 996 | else | 996 | else |
| @@ -1017,8 +1017,9 @@ LIB3270_ACTION( nextfield ) | @@ -1017,8 +1017,9 @@ LIB3270_ACTION( nextfield ) | ||
| 1017 | } | 1017 | } |
| 1018 | } | 1018 | } |
| 1019 | #if defined(X3270_ANSI) /*[*/ | 1019 | #if defined(X3270_ANSI) /*[*/ |
| 1020 | - if (IN_ANSI) { | ||
| 1021 | - net_sendc('\t'); | 1020 | + if (IN_ANSI) |
| 1021 | + { | ||
| 1022 | + net_sendc(hSession,'\t'); | ||
| 1022 | return 0; | 1023 | return 0; |
| 1023 | } | 1024 | } |
| 1024 | #endif /*]*/ | 1025 | #endif /*]*/ |
| @@ -1344,8 +1345,9 @@ LIB3270_ACTION( delete ) | @@ -1344,8 +1345,9 @@ LIB3270_ACTION( delete ) | ||
| 1344 | return 0; | 1345 | return 0; |
| 1345 | } | 1346 | } |
| 1346 | #if defined(X3270_ANSI) /*[*/ | 1347 | #if defined(X3270_ANSI) /*[*/ |
| 1347 | - if (IN_ANSI) { | ||
| 1348 | - net_sendc('\177'); | 1348 | + if (IN_ANSI) |
| 1349 | + { | ||
| 1350 | + net_sendc(hSession,'\177'); | ||
| 1349 | return 0; | 1351 | return 0; |
| 1350 | } | 1352 | } |
| 1351 | #endif /*]*/ | 1353 | #endif /*]*/ |
| @@ -1376,7 +1378,7 @@ LIB3270_ACTION( backspace ) | @@ -1376,7 +1378,7 @@ LIB3270_ACTION( backspace ) | ||
| 1376 | } | 1378 | } |
| 1377 | #if defined(X3270_ANSI) /*[*/ | 1379 | #if defined(X3270_ANSI) /*[*/ |
| 1378 | if (IN_ANSI) { | 1380 | if (IN_ANSI) { |
| 1379 | - net_send_erase(); | 1381 | + net_send_erase(hSession); |
| 1380 | return 0; | 1382 | return 0; |
| 1381 | } | 1383 | } |
| 1382 | #endif /*]*/ | 1384 | #endif /*]*/ |
| @@ -1472,7 +1474,7 @@ LIB3270_ACTION( erase ) | @@ -1472,7 +1474,7 @@ LIB3270_ACTION( erase ) | ||
| 1472 | #if defined(X3270_ANSI) /*[*/ | 1474 | #if defined(X3270_ANSI) /*[*/ |
| 1473 | if (IN_ANSI) | 1475 | if (IN_ANSI) |
| 1474 | { | 1476 | { |
| 1475 | - net_send_erase(); | 1477 | + net_send_erase(hSession); |
| 1476 | return 0; | 1478 | return 0; |
| 1477 | } | 1479 | } |
| 1478 | #endif /*]*/ | 1480 | #endif /*]*/ |
| @@ -1798,7 +1800,7 @@ LIB3270_CURSOR_ACTION( newline ) | @@ -1798,7 +1800,7 @@ LIB3270_CURSOR_ACTION( newline ) | ||
| 1798 | #if defined(X3270_ANSI) /*[*/ | 1800 | #if defined(X3270_ANSI) /*[*/ |
| 1799 | if (IN_ANSI) | 1801 | if (IN_ANSI) |
| 1800 | { | 1802 | { |
| 1801 | - net_sendc('\n'); | 1803 | + net_sendc(hSession,'\n'); |
| 1802 | return 0; | 1804 | return 0; |
| 1803 | } | 1805 | } |
| 1804 | #endif /*]*/ | 1806 | #endif /*]*/ |
| @@ -2125,7 +2127,7 @@ LIB3270_ACTION( deleteword ) | @@ -2125,7 +2127,7 @@ LIB3270_ACTION( deleteword ) | ||
| 2125 | } | 2127 | } |
| 2126 | #if defined(X3270_ANSI) /*[*/ | 2128 | #if defined(X3270_ANSI) /*[*/ |
| 2127 | if (IN_ANSI) { | 2129 | if (IN_ANSI) { |
| 2128 | - net_send_werase(); | 2130 | + net_send_werase(hSession); |
| 2129 | return 0; | 2131 | return 0; |
| 2130 | } | 2132 | } |
| 2131 | #endif /*]*/ | 2133 | #endif /*]*/ |
| @@ -2193,7 +2195,7 @@ LIB3270_ACTION( deletefield ) | @@ -2193,7 +2195,7 @@ LIB3270_ACTION( deletefield ) | ||
| 2193 | } | 2195 | } |
| 2194 | #if defined(X3270_ANSI) /*[*/ | 2196 | #if defined(X3270_ANSI) /*[*/ |
| 2195 | if (IN_ANSI) { | 2197 | if (IN_ANSI) { |
| 2196 | - net_send_kill(); | 2198 | + net_send_kill(hSession); |
| 2197 | return 0; | 2199 | return 0; |
| 2198 | } | 2200 | } |
| 2199 | #endif /*]*/ | 2201 | #endif /*]*/ |
src/lib3270/sf.c
| @@ -357,7 +357,7 @@ sf_read_part(unsigned char buf[], unsigned buflen) | @@ -357,7 +357,7 @@ sf_read_part(unsigned char buf[], unsigned buflen) | ||
| 357 | return PDS_BAD_CMD; | 357 | return PDS_BAD_CMD; |
| 358 | } | 358 | } |
| 359 | trace_ds(&h3270,"\n"); | 359 | trace_ds(&h3270,"\n"); |
| 360 | - ctlr_read_modified(AID_QREPLY, True); | 360 | + ctlr_read_modified(&h3270, AID_QREPLY, True); |
| 361 | break; | 361 | break; |
| 362 | case SNA_CMD_RB: | 362 | case SNA_CMD_RB: |
| 363 | trace_ds(&h3270," ReadBuffer"); | 363 | trace_ds(&h3270," ReadBuffer"); |
| @@ -375,7 +375,7 @@ sf_read_part(unsigned char buf[], unsigned buflen) | @@ -375,7 +375,7 @@ sf_read_part(unsigned char buf[], unsigned buflen) | ||
| 375 | return PDS_BAD_CMD; | 375 | return PDS_BAD_CMD; |
| 376 | } | 376 | } |
| 377 | trace_ds(&h3270,"\n"); | 377 | trace_ds(&h3270,"\n"); |
| 378 | - ctlr_read_modified(AID_QREPLY, False); | 378 | + ctlr_read_modified(&h3270, AID_QREPLY, False); |
| 379 | break; | 379 | break; |
| 380 | default: | 380 | default: |
| 381 | trace_ds(&h3270," unknown type 0x%02x\n", buf[4]); | 381 | trace_ds(&h3270," unknown type 0x%02x\n", buf[4]); |
src/lib3270/telnet.c
| @@ -2850,8 +2850,9 @@ static void tn3270e_nak(H3270 *hSession, enum pds rv) | @@ -2850,8 +2850,9 @@ static void tn3270e_nak(H3270 *hSession, enum pds rv) | ||
| 2850 | net_rawout(hSession, rsp_buf, rsp_len); | 2850 | net_rawout(hSession, rsp_buf, rsp_len); |
| 2851 | } | 2851 | } |
| 2852 | 2852 | ||
| 2853 | -#if defined(X3270_TRACE) /*[*/ | ||
| 2854 | -/* Add a dummy TN3270E header to the output buffer. */ | 2853 | +/* |
| 2854 | +#if defined(X3270_TRACE) | ||
| 2855 | +// Add a dummy TN3270E header to the output buffer. | ||
| 2855 | Boolean | 2856 | Boolean |
| 2856 | net_add_dummy_tn3270e(void) | 2857 | net_add_dummy_tn3270e(void) |
| 2857 | { | 2858 | { |
| @@ -2883,7 +2884,8 @@ net_add_dummy_tn3270e(void) | @@ -2883,7 +2884,8 @@ net_add_dummy_tn3270e(void) | ||
| 2883 | h3270.obptr += EH_SIZE; | 2884 | h3270.obptr += EH_SIZE; |
| 2884 | return True; | 2885 | return True; |
| 2885 | } | 2886 | } |
| 2886 | -#endif /*]*/ | 2887 | +#endif |
| 2888 | +*/ | ||
| 2887 | #endif /*]*/ | 2889 | #endif /*]*/ |
| 2888 | 2890 | ||
| 2889 | #if defined(X3270_TRACE) /*[*/ | 2891 | #if defined(X3270_TRACE) /*[*/ |
| @@ -2900,94 +2902,66 @@ net_add_eor(unsigned char *buf, int len) | @@ -2900,94 +2902,66 @@ net_add_eor(unsigned char *buf, int len) | ||
| 2900 | 2902 | ||
| 2901 | 2903 | ||
| 2902 | #if defined(X3270_ANSI) /*[*/ | 2904 | #if defined(X3270_ANSI) /*[*/ |
| 2903 | -/* | ||
| 2904 | - * net_sendc | ||
| 2905 | - * Send a character of user data over the network in ANSI mode. | 2905 | +/** |
| 2906 | + * Send a character of user data over the network in ANSI mode. | ||
| 2907 | + * | ||
| 2908 | + * @param hSession Session handle. | ||
| 2909 | + * @param c Character to send. | ||
| 2910 | + * | ||
| 2906 | */ | 2911 | */ |
| 2907 | void | 2912 | void |
| 2908 | -net_sendc(char c) | 2913 | +net_sendc(H3270 *hSession, char c) |
| 2909 | { | 2914 | { |
| 2910 | - if (c == '\r' && !h3270.linemode | ||
| 2911 | -/* | ||
| 2912 | -#if defined(LOCAL_PROCESS) | ||
| 2913 | - && !local_process | ||
| 2914 | -#endif | ||
| 2915 | -*/ | ||
| 2916 | - ) { | 2915 | + if (c == '\r' && !hSession->linemode) |
| 2916 | + { | ||
| 2917 | /* CR must be quoted */ | 2917 | /* CR must be quoted */ |
| 2918 | - net_cookout(&h3270,"\r\0", 2); | ||
| 2919 | - } else { | ||
| 2920 | - net_cookout(&h3270,&c, 1); | 2918 | + net_cookout(hSession,"\r\0", 2); |
| 2919 | + } | ||
| 2920 | + else | ||
| 2921 | + { | ||
| 2922 | + net_cookout(hSession,&c, 1); | ||
| 2921 | } | 2923 | } |
| 2922 | } | 2924 | } |
| 2923 | 2925 | ||
| 2924 | - | ||
| 2925 | -/* | ||
| 2926 | - * net_sends | ||
| 2927 | - * Send a null-terminated string of user data in ANSI mode. | 2926 | +/** |
| 2927 | + * Send a null-terminated string of user data in ANSI mode. | ||
| 2928 | + * | ||
| 2929 | + * @param hSession Session handle. | ||
| 2930 | + * @param s String to send. | ||
| 2928 | */ | 2931 | */ |
| 2929 | -void | ||
| 2930 | -net_sends(const char *s) | 2932 | +void net_sends(H3270 *hSession,const char *s) |
| 2931 | { | 2933 | { |
| 2932 | - net_cookout(&h3270, s, strlen(s)); | 2934 | + net_cookout(hSession, s, strlen(s)); |
| 2933 | } | 2935 | } |
| 2934 | 2936 | ||
| 2935 | - | ||
| 2936 | -/* | ||
| 2937 | - * net_send_erase | ||
| 2938 | - * Sends the KILL character in ANSI mode. | 2937 | +/** |
| 2938 | + * Sends the ERASE character in ANSI mode. | ||
| 2939 | + * | ||
| 2939 | */ | 2940 | */ |
| 2940 | -void | ||
| 2941 | -net_send_erase(void) | 2941 | +void net_send_erase(H3270 *hSession) |
| 2942 | { | 2942 | { |
| 2943 | - net_cookout(&h3270, &verase, 1); | 2943 | + net_cookout(hSession, &verase, 1); |
| 2944 | } | 2944 | } |
| 2945 | 2945 | ||
| 2946 | - | ||
| 2947 | -/* | ||
| 2948 | - * net_send_kill | 2946 | +/** |
| 2949 | * Sends the KILL character in ANSI mode. | 2947 | * Sends the KILL character in ANSI mode. |
| 2950 | */ | 2948 | */ |
| 2951 | -void | ||
| 2952 | -net_send_kill(void) | 2949 | +void net_send_kill(H3270 *hSession) |
| 2953 | { | 2950 | { |
| 2954 | - net_cookout(&h3270, &vkill, 1); | 2951 | + net_cookout(hSession, &vkill, 1); |
| 2955 | } | 2952 | } |
| 2956 | 2953 | ||
| 2957 | - | ||
| 2958 | -/* | ||
| 2959 | - * net_send_werase | ||
| 2960 | - * Sends the WERASE character in ANSI mode. | 2954 | +/** |
| 2955 | + * Sends the WERASE character in ANSI mode. | ||
| 2961 | */ | 2956 | */ |
| 2962 | -void | ||
| 2963 | -net_send_werase(void) | 2957 | +void net_send_werase(H3270 *hSession) |
| 2964 | { | 2958 | { |
| 2965 | - net_cookout(&h3270, &vwerase, 1); | 2959 | + net_cookout(hSession, &vwerase, 1); |
| 2966 | } | 2960 | } |
| 2967 | #endif /*]*/ | 2961 | #endif /*]*/ |
| 2968 | 2962 | ||
| 2969 | - | ||
| 2970 | -#if defined(X3270_MENUS) /*[*/ | ||
| 2971 | /* | 2963 | /* |
| 2972 | - * External entry points to negotiate line or character mode. | ||
| 2973 | - */ /* | ||
| 2974 | -void | ||
| 2975 | -net_linemode(void) | ||
| 2976 | -{ | ||
| 2977 | - if (!CONNECTED) | ||
| 2978 | - return; | ||
| 2979 | - if (hisopts[TELOPT_ECHO]) { | ||
| 2980 | - dont_opt[2] = TELOPT_ECHO; | ||
| 2981 | - net_rawout(dont_opt, sizeof(dont_opt)); | ||
| 2982 | - trace_dsn(&h3270,"SENT %s %s\n", cmd(DONT), opt(TELOPT_ECHO)); | ||
| 2983 | - } | ||
| 2984 | - if (hisopts[TELOPT_SGA]) { | ||
| 2985 | - dont_opt[2] = TELOPT_SGA; | ||
| 2986 | - net_rawout(dont_opt, sizeof(dont_opt)); | ||
| 2987 | - trace_dsn(&h3270,"SENT %s %s\n", cmd(DONT), opt(TELOPT_SGA)); | ||
| 2988 | - } | ||
| 2989 | -} | ||
| 2990 | -*/ | 2964 | +#if defined(X3270_MENUS) |
| 2991 | 2965 | ||
| 2992 | void net_charmode(H3270 *hSession) | 2966 | void net_charmode(H3270 *hSession) |
| 2993 | { | 2967 | { |
| @@ -3008,9 +2982,9 @@ void net_charmode(H3270 *hSession) | @@ -3008,9 +2982,9 @@ void net_charmode(H3270 *hSession) | ||
| 3008 | trace_dsn(hSession,"SENT %s %s\n", cmd(DO), opt(TELOPT_SGA)); | 2982 | trace_dsn(hSession,"SENT %s %s\n", cmd(DO), opt(TELOPT_SGA)); |
| 3009 | } | 2983 | } |
| 3010 | } | 2984 | } |
| 3011 | -#endif /*]*/ | 2985 | +#endif |
| 2986 | +*/ | ||
| 3012 | 2987 | ||
| 3013 | - | ||
| 3014 | /* | 2988 | /* |
| 3015 | * net_break | 2989 | * net_break |
| 3016 | * Send telnet break, which is used to implement 3270 ATTN. | 2990 | * Send telnet break, which is used to implement 3270 ATTN. |
| @@ -3107,138 +3081,6 @@ parse_ctlchar(char *s) | @@ -3107,138 +3081,6 @@ parse_ctlchar(char *s) | ||
| 3107 | } | 3081 | } |
| 3108 | #endif /*]*/ | 3082 | #endif /*]*/ |
| 3109 | 3083 | ||
| 3110 | -#if (defined(X3270_MENUS) || defined(C3270)) && defined(X3270_ANSI) /*[*/ | ||
| 3111 | -/* | ||
| 3112 | - * net_linemode_chars | ||
| 3113 | - * Report line-mode characters. | ||
| 3114 | - */ /* | ||
| 3115 | -struct ctl_char * | ||
| 3116 | -net_linemode_chars(void) | ||
| 3117 | -{ | ||
| 3118 | - static struct ctl_char c[9]; | ||
| 3119 | - | ||
| 3120 | - c[0].name = "intr"; (void) strcpy(c[0].value, ctl_see(vintr)); | ||
| 3121 | - c[1].name = "quit"; (void) strcpy(c[1].value, ctl_see(vquit)); | ||
| 3122 | - c[2].name = "erase"; (void) strcpy(c[2].value, ctl_see(verase)); | ||
| 3123 | - c[3].name = "kill"; (void) strcpy(c[3].value, ctl_see(vkill)); | ||
| 3124 | - c[4].name = "eof"; (void) strcpy(c[4].value, ctl_see(veof)); | ||
| 3125 | - c[5].name = "werase"; (void) strcpy(c[5].value, ctl_see(vwerase)); | ||
| 3126 | - c[6].name = "rprnt"; (void) strcpy(c[6].value, ctl_see(vrprnt)); | ||
| 3127 | - c[7].name = "lnext"; (void) strcpy(c[7].value, ctl_see(vlnext)); | ||
| 3128 | - c[8].name = 0; | ||
| 3129 | - | ||
| 3130 | - return c; | ||
| 3131 | -} */ | ||
| 3132 | -#endif /*]*/ | ||
| 3133 | - | ||
| 3134 | -#if defined(X3270_TRACE) /*[*/ | ||
| 3135 | -/* | ||
| 3136 | - * Construct a string to reproduce the current TELNET options. | ||
| 3137 | - * Returns a Boolean indicating whether it is necessary. | ||
| 3138 | - */ /* | ||
| 3139 | -Boolean | ||
| 3140 | -net_snap_options(void) | ||
| 3141 | -{ | ||
| 3142 | - Boolean any = False; | ||
| 3143 | - int i; | ||
| 3144 | - static unsigned char ttype_str[] = { | ||
| 3145 | - IAC, DO, TELOPT_TTYPE, | ||
| 3146 | - IAC, SB, TELOPT_TTYPE, TELQUAL_SEND, IAC, SE | ||
| 3147 | - }; | ||
| 3148 | - | ||
| 3149 | - if (!CONNECTED) | ||
| 3150 | - return False; | ||
| 3151 | - | ||
| 3152 | - h3270.obptr = h3270.obuf; | ||
| 3153 | - | ||
| 3154 | - // Do TTYPE first. | ||
| 3155 | - if (h3270.myopts[TELOPT_TTYPE]) { | ||
| 3156 | - unsigned j; | ||
| 3157 | - | ||
| 3158 | - space3270out(sizeof(ttype_str)); | ||
| 3159 | - for (j = 0; j < sizeof(ttype_str); j++) | ||
| 3160 | - *h3270.obptr++ = ttype_str[j]; | ||
| 3161 | - } | ||
| 3162 | - | ||
| 3163 | - // Do the other options. | ||
| 3164 | - for (i = 0; i < LIB3270_TELNET_N_OPTS; i++) { | ||
| 3165 | - space3270out(6); | ||
| 3166 | - if (i == TELOPT_TTYPE) | ||
| 3167 | - continue; | ||
| 3168 | - if (h3270.hisopts[i]) { | ||
| 3169 | - *h3270.obptr++ = IAC; | ||
| 3170 | - *h3270.obptr++ = WILL; | ||
| 3171 | - *h3270.obptr++ = (unsigned char)i; | ||
| 3172 | - any = True; | ||
| 3173 | - } | ||
| 3174 | - if (h3270.myopts[i]) { | ||
| 3175 | - *h3270.obptr++ = IAC; | ||
| 3176 | - *h3270.obptr++ = DO; | ||
| 3177 | - *h3270.obptr++ = (unsigned char)i; | ||
| 3178 | - any = True; | ||
| 3179 | - } | ||
| 3180 | - } | ||
| 3181 | - | ||
| 3182 | -#if defined(X3270_TN3270E) | ||
| 3183 | - // If we're in TN3270E mode, snap the subnegotations as well. | ||
| 3184 | - if (h3270.myopts[TELOPT_TN3270E]) { | ||
| 3185 | - any = True; | ||
| 3186 | - | ||
| 3187 | - space3270out(5 + | ||
| 3188 | - ((h3270.connected_type != CN) ? strlen(h3270.connected_type) : 0) + | ||
| 3189 | - ((h3270.connected_lu != CN) ? + strlen(h3270.connected_lu) : 0) + | ||
| 3190 | - 2); | ||
| 3191 | - *h3270.obptr++ = IAC; | ||
| 3192 | - *h3270.obptr++ = SB; | ||
| 3193 | - *h3270.obptr++ = TELOPT_TN3270E; | ||
| 3194 | - *h3270.obptr++ = TN3270E_OP_DEVICE_TYPE; | ||
| 3195 | - *h3270.obptr++ = TN3270E_OP_IS; | ||
| 3196 | - if (h3270.connected_type != CN) { | ||
| 3197 | - (void) memcpy(h3270.obptr, h3270.connected_type,strlen(h3270.connected_type)); | ||
| 3198 | - h3270.obptr += strlen(h3270.connected_type); | ||
| 3199 | - } | ||
| 3200 | - if (h3270.connected_lu != CN) { | ||
| 3201 | - *h3270.obptr++ = TN3270E_OP_CONNECT; | ||
| 3202 | - (void) memcpy(h3270.obptr, h3270.connected_lu,strlen(h3270.connected_lu)); | ||
| 3203 | - h3270.obptr += strlen(h3270.connected_lu); | ||
| 3204 | - } | ||
| 3205 | - *h3270.obptr++ = IAC; | ||
| 3206 | - *h3270.obptr++ = SE; | ||
| 3207 | - | ||
| 3208 | - space3270out(38); | ||
| 3209 | - (void) memcpy(h3270.obptr, functions_req, 4); | ||
| 3210 | - h3270.obptr += 4; | ||
| 3211 | - *h3270.obptr++ = TN3270E_OP_IS; | ||
| 3212 | - for (i = 0; i < 32; i++) { | ||
| 3213 | - if (h3270.e_funcs & E_OPT(i)) | ||
| 3214 | - *h3270.obptr++ = i; | ||
| 3215 | - } | ||
| 3216 | - *h3270.obptr++ = IAC; | ||
| 3217 | - *h3270.obptr++ = SE; | ||
| 3218 | - | ||
| 3219 | - if (h3270.tn3270e_bound) { | ||
| 3220 | - tn3270e_header *h; | ||
| 3221 | - | ||
| 3222 | - space3270out(EH_SIZE + 3); | ||
| 3223 | - h = (tn3270e_header *)h3270.obptr; | ||
| 3224 | - h->data_type = TN3270E_DT_BIND_IMAGE; | ||
| 3225 | - h->request_flag = 0; | ||
| 3226 | - h->response_flag = 0; | ||
| 3227 | - h->seq_number[0] = 0; | ||
| 3228 | - h->seq_number[1] = 0; | ||
| 3229 | - h3270.obptr += EH_SIZE; | ||
| 3230 | - *h3270.obptr++ = 1; // dummy | ||
| 3231 | - *h3270.obptr++ = IAC; | ||
| 3232 | - *h3270.obptr++ = EOR; | ||
| 3233 | - } | ||
| 3234 | - } | ||
| 3235 | -#endif | ||
| 3236 | - return any; | ||
| 3237 | -} | ||
| 3238 | -*/ | ||
| 3239 | -#endif | ||
| 3240 | - | ||
| 3241 | - | ||
| 3242 | /* | 3084 | /* |
| 3243 | * Set blocking/non-blocking mode on the socket. On error, pops up an error | 3085 | * Set blocking/non-blocking mode on the socket. On error, pops up an error |
| 3244 | * message, but does not close the socket. | 3086 | * message, but does not close the socket. |
src/lib3270/telnetc.h
| @@ -30,10 +30,10 @@ struct ctl_char { | @@ -30,10 +30,10 @@ struct ctl_char { | ||
| 30 | }; | 30 | }; |
| 31 | 31 | ||
| 32 | LIB3270_INTERNAL void net_abort(H3270 *hSession); | 32 | LIB3270_INTERNAL void net_abort(H3270 *hSession); |
| 33 | -LIB3270_INTERNAL Boolean net_add_dummy_tn3270e(void); | 33 | +// LIB3270_INTERNAL Boolean net_add_dummy_tn3270e(H3270 *hSession); |
| 34 | LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); | 34 | LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); |
| 35 | LIB3270_INTERNAL void net_break(H3270 *hSession); | 35 | LIB3270_INTERNAL void net_break(H3270 *hSession); |
| 36 | -LIB3270_INTERNAL void net_charmode(H3270 *hSession); | 36 | +// LIB3270_INTERNAL void net_charmode(H3270 *hSession); |
| 37 | LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); | 37 | LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); |
| 38 | LIB3270_INTERNAL void net_disconnect(H3270 *session); | 38 | LIB3270_INTERNAL void net_disconnect(H3270 *session); |
| 39 | LIB3270_INTERNAL void net_exception(H3270 *session); | 39 | LIB3270_INTERNAL void net_exception(H3270 *session); |
| @@ -43,15 +43,15 @@ LIB3270_INTERNAL void net_interrupt(H3270 *hSession); | @@ -43,15 +43,15 @@ LIB3270_INTERNAL void net_interrupt(H3270 *hSession); | ||
| 43 | // LIB3270_INTERNAL void net_linemode(void); | 43 | // LIB3270_INTERNAL void net_linemode(void); |
| 44 | // LIB3270_INTERNAL struct ctl_char *net_linemode_chars(void); | 44 | // LIB3270_INTERNAL struct ctl_char *net_linemode_chars(void); |
| 45 | LIB3270_INTERNAL void net_output(H3270 *hSession); | 45 | LIB3270_INTERNAL void net_output(H3270 *hSession); |
| 46 | -LIB3270_INTERNAL const char *net_query_bind_plu_name(void); | ||
| 47 | -LIB3270_INTERNAL const char *net_query_connection_state(void); | ||
| 48 | -LIB3270_INTERNAL const char *net_query_host(void); | ||
| 49 | -LIB3270_INTERNAL const char *net_query_lu_name(void); | ||
| 50 | -LIB3270_INTERNAL void net_sendc(char c); | ||
| 51 | -LIB3270_INTERNAL void net_sends(const char *s); | ||
| 52 | -LIB3270_INTERNAL void net_send_erase(void); | ||
| 53 | -LIB3270_INTERNAL void net_send_kill(void); | ||
| 54 | -LIB3270_INTERNAL void net_send_werase(void); | 46 | +//LIB3270_INTERNAL const char *net_query_bind_plu_name(void); |
| 47 | +//LIB3270_INTERNAL const char *net_query_connection_state(void); | ||
| 48 | +//LIB3270_INTERNAL const char *net_query_host(void); | ||
| 49 | +//LIB3270_INTERNAL const char *net_query_lu_name(void); | ||
| 50 | +LIB3270_INTERNAL void net_sendc(H3270 *hSession, char c); | ||
| 51 | +LIB3270_INTERNAL void net_sends(H3270 *hSession, const char *s); | ||
| 52 | +LIB3270_INTERNAL void net_send_erase(H3270 *hSession); | ||
| 53 | +LIB3270_INTERNAL void net_send_kill(H3270 *hSession); | ||
| 54 | +LIB3270_INTERNAL void net_send_werase(H3270 *hSession); | ||
| 55 | // LIB3270_INTERNAL Boolean net_snap_options(void); | 55 | // LIB3270_INTERNAL Boolean net_snap_options(void); |
| 56 | LIB3270_INTERNAL void space3270out(H3270 *hSession, int n); | 56 | LIB3270_INTERNAL void space3270out(H3270 *hSession, int n); |
| 57 | // LIB3270_INTERNAL const char *tn3270e_current_opts(void); | 57 | // LIB3270_INTERNAL const char *tn3270e_current_opts(void); |