Commit 07fe2293fc7c9d349d1d1fb97195880834ea0a4f
1 parent
5df280a2
Exists in
master
and in
5 other branches
Ajustes para multi-sessão
Showing
7 changed files
with
232 additions
and
232 deletions
Show diff stats
src/include/lib3270/session.h
@@ -182,6 +182,9 @@ | @@ -182,6 +182,9 @@ | ||
182 | // Telnet.c | 182 | // Telnet.c |
183 | unsigned char * ibuf; | 183 | unsigned char * ibuf; |
184 | int ibuf_size; /**< size of ibuf */ | 184 | int ibuf_size; /**< size of ibuf */ |
185 | + unsigned char * obuf; /**< 3270 output buffer */ | ||
186 | + unsigned char * obptr; | ||
187 | + | ||
185 | unsigned char myopts[LIB3270_TELNET_N_OPTS]; | 188 | unsigned char myopts[LIB3270_TELNET_N_OPTS]; |
186 | unsigned char hisopts[LIB3270_TELNET_N_OPTS]; | 189 | unsigned char hisopts[LIB3270_TELNET_N_OPTS]; |
187 | 190 |
src/lib3270/ctlr.c
@@ -549,9 +549,9 @@ insert_sa1(unsigned char attr, unsigned char value, unsigned char *currentp, Boo | @@ -549,9 +549,9 @@ insert_sa1(unsigned char attr, unsigned char value, unsigned char *currentp, Boo | ||
549 | return; | 549 | return; |
550 | *currentp = value; | 550 | *currentp = value; |
551 | space3270out(3); | 551 | space3270out(3); |
552 | - *obptr++ = ORDER_SA; | ||
553 | - *obptr++ = attr; | ||
554 | - *obptr++ = value; | 552 | + *h3270.obptr++ = ORDER_SA; |
553 | + *h3270.obptr++ = attr; | ||
554 | + *h3270.obptr++ = value; | ||
555 | if (*anyp) | 555 | if (*anyp) |
556 | trace_ds("'"); | 556 | trace_ds("'"); |
557 | trace_ds(" SetAttribute(%s)", see_efa(attr, value)); | 557 | trace_ds(" SetAttribute(%s)", see_efa(attr, value)); |
@@ -626,16 +626,16 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -626,16 +626,16 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
626 | #endif /*]*/ | 626 | #endif /*]*/ |
627 | 627 | ||
628 | trace_ds("> "); | 628 | trace_ds("> "); |
629 | - obptr = obuf; | 629 | + h3270.obptr = h3270.obuf; |
630 | 630 | ||
631 | switch (aid_byte) { | 631 | switch (aid_byte) { |
632 | 632 | ||
633 | case AID_SYSREQ: /* test request */ | 633 | case AID_SYSREQ: /* test request */ |
634 | space3270out(4); | 634 | space3270out(4); |
635 | - *obptr++ = 0x01; /* soh */ | ||
636 | - *obptr++ = 0x5b; /* % */ | ||
637 | - *obptr++ = 0x61; /* / */ | ||
638 | - *obptr++ = 0x02; /* stx */ | 635 | + *h3270.obptr++ = 0x01; /* soh */ |
636 | + *h3270.obptr++ = 0x5b; /* % */ | ||
637 | + *h3270.obptr++ = 0x61; /* / */ | ||
638 | + *h3270.obptr++ = 0x02; /* stx */ | ||
639 | trace_ds("SYSREQ"); | 639 | trace_ds("SYSREQ"); |
640 | break; | 640 | break; |
641 | 641 | ||
@@ -655,11 +655,11 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -655,11 +655,11 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
655 | default: /* ordinary AID */ | 655 | default: /* ordinary AID */ |
656 | if (!IN_SSCP) { | 656 | if (!IN_SSCP) { |
657 | space3270out(3); | 657 | space3270out(3); |
658 | - *obptr++ = aid_byte; | 658 | + *h3270.obptr++ = aid_byte; |
659 | trace_ds("%s",see_aid(aid_byte)); | 659 | trace_ds("%s",see_aid(aid_byte)); |
660 | if (short_read) | 660 | if (short_read) |
661 | goto rm_done; | 661 | goto rm_done; |
662 | - ENCODE_BADDR(obptr, h3270.cursor_addr); | 662 | + ENCODE_BADDR(h3270.obptr, h3270.cursor_addr); |
663 | trace_ds("%s",rcba(&h3270,h3270.cursor_addr)); | 663 | trace_ds("%s",rcba(&h3270,h3270.cursor_addr)); |
664 | } else { | 664 | } else { |
665 | space3270out(1); /* just in case */ | 665 | space3270out(1); /* just in case */ |
@@ -682,8 +682,8 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -682,8 +682,8 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
682 | 682 | ||
683 | INC_BA(baddr); | 683 | INC_BA(baddr); |
684 | space3270out(3); | 684 | space3270out(3); |
685 | - *obptr++ = ORDER_SBA; | ||
686 | - ENCODE_BADDR(obptr, baddr); | 685 | + *h3270.obptr++ = ORDER_SBA; |
686 | + ENCODE_BADDR(h3270.obptr, baddr); | ||
687 | trace_ds(" SetBufferAddress%s (Cols: %d Rows: %d)", rcba(&h3270,baddr), h3270.cols, h3270.rows); | 687 | trace_ds(" SetBufferAddress%s (Cols: %d Rows: %d)", rcba(&h3270,baddr), h3270.cols, h3270.rows); |
688 | while (!h3270.ea_buf[baddr].fa) { | 688 | while (!h3270.ea_buf[baddr].fa) { |
689 | 689 | ||
@@ -697,14 +697,14 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -697,14 +697,14 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
697 | &any); | 697 | &any); |
698 | if (h3270.ea_buf[baddr].cs & CS_GE) { | 698 | if (h3270.ea_buf[baddr].cs & CS_GE) { |
699 | space3270out(1); | 699 | space3270out(1); |
700 | - *obptr++ = ORDER_GE; | 700 | + *h3270.obptr++ = ORDER_GE; |
701 | if (any) | 701 | if (any) |
702 | trace_ds("'"); | 702 | trace_ds("'"); |
703 | trace_ds(" GraphicEscape"); | 703 | trace_ds(" GraphicEscape"); |
704 | any = False; | 704 | any = False; |
705 | } | 705 | } |
706 | space3270out(1); | 706 | space3270out(1); |
707 | - *obptr++ = h3270.ea_buf[baddr].cc; | 707 | + *h3270.obptr++ = h3270.ea_buf[baddr].cc; |
708 | if (!any) | 708 | if (!any) |
709 | trace_ds(" '"); | 709 | trace_ds(" '"); |
710 | trace_ds("%s",see_ebc(h3270.ea_buf[baddr].cc)); | 710 | trace_ds("%s",see_ebc(h3270.ea_buf[baddr].cc)); |
@@ -742,14 +742,14 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | @@ -742,14 +742,14 @@ ctlr_read_modified(unsigned char aid_byte, Boolean all) | ||
742 | &any); | 742 | &any); |
743 | if (h3270.ea_buf[baddr].cs & CS_GE) { | 743 | if (h3270.ea_buf[baddr].cs & CS_GE) { |
744 | space3270out(1); | 744 | space3270out(1); |
745 | - *obptr++ = ORDER_GE; | 745 | + *h3270.obptr++ = ORDER_GE; |
746 | if (any) | 746 | if (any) |
747 | trace_ds("' "); | 747 | trace_ds("' "); |
748 | trace_ds(" GraphicEscape "); | 748 | trace_ds(" GraphicEscape "); |
749 | any = False; | 749 | any = False; |
750 | } | 750 | } |
751 | space3270out(1); | 751 | space3270out(1); |
752 | - *obptr++ = h3270.ea_buf[baddr].cc; | 752 | + *h3270.obptr++ = h3270.ea_buf[baddr].cc; |
753 | if (!any) | 753 | if (!any) |
754 | trace_ds("%s","'"); | 754 | trace_ds("%s","'"); |
755 | trace_ds("%s",see_ebc(h3270.ea_buf[baddr].cc)); | 755 | trace_ds("%s",see_ebc(h3270.ea_buf[baddr].cc)); |
@@ -797,11 +797,11 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | @@ -797,11 +797,11 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | ||
797 | #endif /*]*/ | 797 | #endif /*]*/ |
798 | 798 | ||
799 | trace_ds("> "); | 799 | trace_ds("> "); |
800 | - obptr = obuf; | 800 | + h3270.obptr = h3270.obuf; |
801 | 801 | ||
802 | space3270out(3); | 802 | space3270out(3); |
803 | - *obptr++ = aid_byte; | ||
804 | - ENCODE_BADDR(obptr, hSession->cursor_addr); | 803 | + *h3270.obptr++ = aid_byte; |
804 | + ENCODE_BADDR(h3270.obptr, hSession->cursor_addr); | ||
805 | trace_ds("%s%s", see_aid(aid_byte), rcba(hSession,hSession->cursor_addr)); | 805 | trace_ds("%s%s", see_aid(aid_byte), rcba(hSession,hSession->cursor_addr)); |
806 | 806 | ||
807 | baddr = 0; | 807 | baddr = 0; |
@@ -809,16 +809,16 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | @@ -809,16 +809,16 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | ||
809 | if (hSession->ea_buf[baddr].fa) { | 809 | if (hSession->ea_buf[baddr].fa) { |
810 | if (hSession->reply_mode == SF_SRM_FIELD) { | 810 | if (hSession->reply_mode == SF_SRM_FIELD) { |
811 | space3270out(2); | 811 | space3270out(2); |
812 | - *obptr++ = ORDER_SF; | 812 | + *h3270.obptr++ = ORDER_SF; |
813 | } else { | 813 | } else { |
814 | space3270out(4); | 814 | space3270out(4); |
815 | - *obptr++ = ORDER_SFE; | ||
816 | - attr_count = obptr - obuf; | ||
817 | - *obptr++ = 1; /* for now */ | ||
818 | - *obptr++ = XA_3270; | 815 | + *h3270.obptr++ = ORDER_SFE; |
816 | + attr_count = h3270.obptr - h3270.obuf; | ||
817 | + *h3270.obptr++ = 1; /* for now */ | ||
818 | + *h3270.obptr++ = XA_3270; | ||
819 | } | 819 | } |
820 | fa = hSession->ea_buf[baddr].fa & ~FA_PRINTABLE; | 820 | fa = hSession->ea_buf[baddr].fa & ~FA_PRINTABLE; |
821 | - *obptr++ = code_table[fa]; | 821 | + *h3270.obptr++ = code_table[fa]; |
822 | if (any) | 822 | if (any) |
823 | trace_ds("'"); | 823 | trace_ds("'"); |
824 | trace_ds(" StartField%s%s%s", | 824 | trace_ds(" StartField%s%s%s", |
@@ -827,32 +827,32 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | @@ -827,32 +827,32 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | ||
827 | if (hSession->reply_mode != SF_SRM_FIELD) { | 827 | if (hSession->reply_mode != SF_SRM_FIELD) { |
828 | if (hSession->ea_buf[baddr].fg) { | 828 | if (hSession->ea_buf[baddr].fg) { |
829 | space3270out(2); | 829 | space3270out(2); |
830 | - *obptr++ = XA_FOREGROUND; | ||
831 | - *obptr++ = hSession->ea_buf[baddr].fg; | 830 | + *h3270.obptr++ = XA_FOREGROUND; |
831 | + *h3270.obptr++ = hSession->ea_buf[baddr].fg; | ||
832 | trace_ds("%s", see_efa(XA_FOREGROUND, hSession->ea_buf[baddr].fg)); | 832 | trace_ds("%s", see_efa(XA_FOREGROUND, hSession->ea_buf[baddr].fg)); |
833 | - (*(obuf + attr_count))++; | 833 | + (*(h3270.obuf + attr_count))++; |
834 | } | 834 | } |
835 | if (hSession->ea_buf[baddr].bg) { | 835 | if (hSession->ea_buf[baddr].bg) { |
836 | space3270out(2); | 836 | space3270out(2); |
837 | - *obptr++ = XA_BACKGROUND; | ||
838 | - *obptr++ = hSession->ea_buf[baddr].bg; | 837 | + *h3270.obptr++ = XA_BACKGROUND; |
838 | + *h3270.obptr++ = hSession->ea_buf[baddr].bg; | ||
839 | trace_ds("%s", see_efa(XA_BACKGROUND, hSession->ea_buf[baddr].bg)); | 839 | trace_ds("%s", see_efa(XA_BACKGROUND, hSession->ea_buf[baddr].bg)); |
840 | - (*(obuf + attr_count))++; | 840 | + (*(h3270.obuf + attr_count))++; |
841 | } | 841 | } |
842 | if (hSession->ea_buf[baddr].gr) { | 842 | if (hSession->ea_buf[baddr].gr) { |
843 | space3270out(2); | 843 | space3270out(2); |
844 | - *obptr++ = XA_HIGHLIGHTING; | ||
845 | - *obptr++ = hSession->ea_buf[baddr].gr | 0xf0; | 844 | + *h3270.obptr++ = XA_HIGHLIGHTING; |
845 | + *h3270.obptr++ = hSession->ea_buf[baddr].gr | 0xf0; | ||
846 | trace_ds("%s", see_efa(XA_HIGHLIGHTING, | 846 | trace_ds("%s", see_efa(XA_HIGHLIGHTING, |
847 | hSession->ea_buf[baddr].gr | 0xf0)); | 847 | hSession->ea_buf[baddr].gr | 0xf0)); |
848 | - (*(obuf + attr_count))++; | 848 | + (*(h3270.obuf + attr_count))++; |
849 | } | 849 | } |
850 | if (hSession->ea_buf[baddr].cs & CS_MASK) { | 850 | if (hSession->ea_buf[baddr].cs & CS_MASK) { |
851 | space3270out(2); | 851 | space3270out(2); |
852 | - *obptr++ = XA_CHARSET; | ||
853 | - *obptr++ = host_cs(hSession->ea_buf[baddr].cs); | 852 | + *h3270.obptr++ = XA_CHARSET; |
853 | + *h3270.obptr++ = host_cs(hSession->ea_buf[baddr].cs); | ||
854 | trace_ds("%s", see_efa(XA_CHARSET,host_cs(hSession->ea_buf[baddr].cs))); | 854 | trace_ds("%s", see_efa(XA_CHARSET,host_cs(hSession->ea_buf[baddr].cs))); |
855 | - (*(obuf + attr_count))++; | 855 | + (*(h3270.obuf + attr_count))++; |
856 | } | 856 | } |
857 | } | 857 | } |
858 | any = False; | 858 | any = False; |
@@ -865,14 +865,14 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | @@ -865,14 +865,14 @@ void ctlr_read_buffer(H3270 *hSession, unsigned char aid_byte) | ||
865 | &any); | 865 | &any); |
866 | if (hSession->ea_buf[baddr].cs & CS_GE) { | 866 | if (hSession->ea_buf[baddr].cs & CS_GE) { |
867 | space3270out(1); | 867 | space3270out(1); |
868 | - *obptr++ = ORDER_GE; | 868 | + *h3270.obptr++ = ORDER_GE; |
869 | if (any) | 869 | if (any) |
870 | trace_ds("'"); | 870 | trace_ds("'"); |
871 | trace_ds(" GraphicEscape"); | 871 | trace_ds(" GraphicEscape"); |
872 | any = False; | 872 | any = False; |
873 | } | 873 | } |
874 | space3270out(1); | 874 | space3270out(1); |
875 | - *obptr++ = hSession->ea_buf[baddr].cc; | 875 | + *h3270.obptr++ = hSession->ea_buf[baddr].cc; |
876 | if (hSession->ea_buf[baddr].cc <= 0x3f || | 876 | if (hSession->ea_buf[baddr].cc <= 0x3f || |
877 | hSession->ea_buf[baddr].cc == 0xff) { | 877 | hSession->ea_buf[baddr].cc == 0xff) { |
878 | if (any) | 878 | if (any) |
src/lib3270/ft_dft.c
@@ -191,12 +191,12 @@ dft_open_request(unsigned short len, unsigned char *cp) | @@ -191,12 +191,12 @@ dft_open_request(unsigned short len, unsigned char *cp) | ||
191 | 191 | ||
192 | /* Acknowledge the Open. */ | 192 | /* Acknowledge the Open. */ |
193 | trace_ds("> WriteStructuredField FileTransferData OpenAck\n"); | 193 | trace_ds("> WriteStructuredField FileTransferData OpenAck\n"); |
194 | - obptr = obuf; | 194 | + h3270.obptr = h3270.obuf; |
195 | space3270out(6); | 195 | space3270out(6); |
196 | - *obptr++ = AID_SF; | ||
197 | - SET16(obptr, 5); | ||
198 | - *obptr++ = SF_TRANSFER_DATA; | ||
199 | - SET16(obptr, 9); | 196 | + *h3270.obptr++ = AID_SF; |
197 | + SET16(h3270.obptr, 5); | ||
198 | + *h3270.obptr++ = SF_TRANSFER_DATA; | ||
199 | + SET16(h3270.obptr, 9); | ||
200 | net_output(); | 200 | net_output(); |
201 | } | 201 | } |
202 | 202 | ||
@@ -316,14 +316,14 @@ dft_data_insert(struct data_buffer *data_bufr) | @@ -316,14 +316,14 @@ dft_data_insert(struct data_buffer *data_bufr) | ||
316 | 316 | ||
317 | /* Send an acknowledgement frame back. */ | 317 | /* Send an acknowledgement frame back. */ |
318 | trace_ds("> WriteStructuredField FileTransferData DataAck(rec=%lu)\n", recnum); | 318 | trace_ds("> WriteStructuredField FileTransferData DataAck(rec=%lu)\n", recnum); |
319 | - obptr = obuf; | 319 | + h3270.obptr = h3270.obuf; |
320 | space3270out(12); | 320 | space3270out(12); |
321 | - *obptr++ = AID_SF; | ||
322 | - SET16(obptr, 11); | ||
323 | - *obptr++ = SF_TRANSFER_DATA; | ||
324 | - SET16(obptr, TR_NORMAL_REPLY); | ||
325 | - SET16(obptr, TR_RECNUM_HDR); | ||
326 | - SET32(obptr, recnum); | 321 | + *h3270.obptr++ = AID_SF; |
322 | + SET16(h3270.obptr, 11); | ||
323 | + *h3270.obptr++ = SF_TRANSFER_DATA; | ||
324 | + SET16(h3270.obptr, TR_NORMAL_REPLY); | ||
325 | + SET16(h3270.obptr, TR_RECNUM_HDR); | ||
326 | + SET32(h3270.obptr, recnum); | ||
327 | recnum++; | 327 | recnum++; |
328 | net_output(); | 328 | net_output(); |
329 | } | 329 | } |
@@ -356,7 +356,7 @@ dft_get_request(void) | @@ -356,7 +356,7 @@ dft_get_request(void) | ||
356 | set_dft_buffersize(); | 356 | set_dft_buffersize(); |
357 | space3270out(dft_buffersize); | 357 | space3270out(dft_buffersize); |
358 | numbytes = dft_buffersize - 27; /* always read 5 bytes less than we're allowed */ | 358 | numbytes = dft_buffersize - 27; /* always read 5 bytes less than we're allowed */ |
359 | - bufptr = obuf + 17; | 359 | + bufptr = h3270.obuf + 17; |
360 | while (!dft_eof && numbytes) { | 360 | while (!dft_eof && numbytes) { |
361 | if (ascii_flag && cr_flag) { | 361 | if (ascii_flag && cr_flag) { |
362 | int c; | 362 | int c; |
@@ -416,22 +416,22 @@ dft_get_request(void) | @@ -416,22 +416,22 @@ dft_get_request(void) | ||
416 | } | 416 | } |
417 | 417 | ||
418 | /* Set up SF header for Data or EOF. */ | 418 | /* Set up SF header for Data or EOF. */ |
419 | - obptr = obuf; | ||
420 | - *obptr++ = AID_SF; | ||
421 | - obptr += 2; /* skip SF length for now */ | ||
422 | - *obptr++ = SF_TRANSFER_DATA; | 419 | + h3270.obptr = h3270.obuf; |
420 | + *h3270.obptr++ = AID_SF; | ||
421 | + h3270.obptr += 2; /* skip SF length for now */ | ||
422 | + *h3270.obptr++ = SF_TRANSFER_DATA; | ||
423 | 423 | ||
424 | if (total_read) { | 424 | if (total_read) { |
425 | trace_ds("> WriteStructuredField FileTransferData Data(rec=%lu) %d bytes\n", | 425 | trace_ds("> WriteStructuredField FileTransferData Data(rec=%lu) %d bytes\n", |
426 | (unsigned long) recnum, (int) total_read); | 426 | (unsigned long) recnum, (int) total_read); |
427 | - SET16(obptr, TR_GET_REPLY); | ||
428 | - SET16(obptr, TR_RECNUM_HDR); | ||
429 | - SET32(obptr, recnum); | 427 | + SET16(h3270.obptr, TR_GET_REPLY); |
428 | + SET16(h3270.obptr, TR_RECNUM_HDR); | ||
429 | + SET32(h3270.obptr, recnum); | ||
430 | recnum++; | 430 | recnum++; |
431 | - SET16(obptr, TR_NOT_COMPRESSED); | ||
432 | - *obptr++ = TR_BEGIN_DATA; | ||
433 | - SET16(obptr, total_read + 5); | ||
434 | - obptr += total_read; | 431 | + SET16(h3270.obptr, TR_NOT_COMPRESSED); |
432 | + *h3270.obptr++ = TR_BEGIN_DATA; | ||
433 | + SET16(h3270.obptr, total_read + 5); | ||
434 | + h3270.obptr += total_read; | ||
435 | 435 | ||
436 | ft_length += total_read; | 436 | ft_length += total_read; |
437 | 437 | ||
@@ -442,25 +442,25 @@ dft_get_request(void) | @@ -442,25 +442,25 @@ dft_get_request(void) | ||
442 | 442 | ||
443 | } else { | 443 | } else { |
444 | trace_ds("> WriteStructuredField FileTransferData EOF\n"); | 444 | trace_ds("> WriteStructuredField FileTransferData EOF\n"); |
445 | - *obptr++ = HIGH8(TR_GET_REQ); | ||
446 | - *obptr++ = TR_ERROR_REPLY; | ||
447 | - SET16(obptr, TR_ERROR_HDR); | ||
448 | - SET16(obptr, TR_ERR_EOF); | 445 | + *h3270.obptr++ = HIGH8(TR_GET_REQ); |
446 | + *h3270.obptr++ = TR_ERROR_REPLY; | ||
447 | + SET16(h3270.obptr, TR_ERROR_HDR); | ||
448 | + SET16(h3270.obptr, TR_ERR_EOF); | ||
449 | 449 | ||
450 | dft_eof = True; | 450 | dft_eof = True; |
451 | } | 451 | } |
452 | 452 | ||
453 | /* Set the SF length. */ | 453 | /* Set the SF length. */ |
454 | - bufptr = obuf + 1; | ||
455 | - SET16(bufptr, obptr - (obuf + 1)); | 454 | + bufptr = h3270.obuf + 1; |
455 | + SET16(bufptr, h3270.obptr - (h3270.obuf + 1)); | ||
456 | 456 | ||
457 | /* Save the data. */ | 457 | /* Save the data. */ |
458 | - dft_savebuf_len = obptr - obuf; | 458 | + dft_savebuf_len = h3270.obptr - h3270.obuf; |
459 | if (dft_savebuf_len > dft_savebuf_max) { | 459 | if (dft_savebuf_len > dft_savebuf_max) { |
460 | dft_savebuf_max = dft_savebuf_len; | 460 | dft_savebuf_max = dft_savebuf_len; |
461 | Replace(dft_savebuf, (unsigned char *)lib3270_malloc(dft_savebuf_max)); | 461 | Replace(dft_savebuf, (unsigned char *)lib3270_malloc(dft_savebuf_max)); |
462 | } | 462 | } |
463 | - (void) memcpy(dft_savebuf, obuf, dft_savebuf_len); | 463 | + (void) memcpy(dft_savebuf, h3270.obuf, dft_savebuf_len); |
464 | h3270.aid = AID_SF; | 464 | h3270.aid = AID_SF; |
465 | 465 | ||
466 | /* Write the data. */ | 466 | /* Write the data. */ |
@@ -478,12 +478,12 @@ dft_close_request(void) | @@ -478,12 +478,12 @@ dft_close_request(void) | ||
478 | */ | 478 | */ |
479 | trace_ds(" Close\n"); | 479 | trace_ds(" Close\n"); |
480 | trace_ds("> WriteStructuredField FileTransferData CloseAck\n"); | 480 | trace_ds("> WriteStructuredField FileTransferData CloseAck\n"); |
481 | - obptr = obuf; | 481 | + h3270.obptr = h3270.obuf; |
482 | space3270out(6); | 482 | space3270out(6); |
483 | - *obptr++ = AID_SF; | ||
484 | - SET16(obptr, 5); /* length */ | ||
485 | - *obptr++ = SF_TRANSFER_DATA; | ||
486 | - SET16(obptr, TR_CLOSE_REPLY); | 483 | + *h3270.obptr++ = AID_SF; |
484 | + SET16(h3270.obptr, 5); /* length */ | ||
485 | + *h3270.obptr++ = SF_TRANSFER_DATA; | ||
486 | + SET16(h3270.obptr, TR_CLOSE_REPLY); | ||
487 | net_output(); | 487 | net_output(); |
488 | } | 488 | } |
489 | 489 | ||
@@ -501,15 +501,15 @@ static void dft_abort(unsigned short code, const char *fmt, ...) | @@ -501,15 +501,15 @@ static void dft_abort(unsigned short code, const char *fmt, ...) | ||
501 | 501 | ||
502 | trace_ds("> WriteStructuredField FileTransferData Error\n"); | 502 | trace_ds("> WriteStructuredField FileTransferData Error\n"); |
503 | 503 | ||
504 | - obptr = obuf; | 504 | + h3270.obptr = h3270.obuf; |
505 | space3270out(10); | 505 | space3270out(10); |
506 | - *obptr++ = AID_SF; | ||
507 | - SET16(obptr, 9); /* length */ | ||
508 | - *obptr++ = SF_TRANSFER_DATA; | ||
509 | - *obptr++ = HIGH8(code); | ||
510 | - *obptr++ = TR_ERROR_REPLY; | ||
511 | - SET16(obptr, TR_ERROR_HDR); | ||
512 | - SET16(obptr, TR_ERR_CMDFAIL); | 506 | + *h3270.obptr++ = AID_SF; |
507 | + SET16(h3270.obptr, 9); /* length */ | ||
508 | + *h3270.obptr++ = SF_TRANSFER_DATA; | ||
509 | + *h3270.obptr++ = HIGH8(code); | ||
510 | + *h3270.obptr++ = TR_ERROR_REPLY; | ||
511 | + SET16(h3270.obptr, TR_ERROR_HDR); | ||
512 | + SET16(h3270.obptr, TR_ERR_CMDFAIL); | ||
513 | net_output(); | 513 | net_output(); |
514 | 514 | ||
515 | /* Update the pop-up and state. */ | 515 | /* Update the pop-up and state. */ |
@@ -535,10 +535,10 @@ dft_read_modified(void) | @@ -535,10 +535,10 @@ dft_read_modified(void) | ||
535 | { | 535 | { |
536 | if (dft_savebuf_len) { | 536 | if (dft_savebuf_len) { |
537 | trace_ds("> WriteStructuredField FileTransferData\n"); | 537 | trace_ds("> WriteStructuredField FileTransferData\n"); |
538 | - obptr = obuf; | 538 | + h3270.obptr = h3270.obuf; |
539 | space3270out(dft_savebuf_len); | 539 | space3270out(dft_savebuf_len); |
540 | - memcpy(obptr, dft_savebuf, dft_savebuf_len); | ||
541 | - obptr += dft_savebuf_len; | 540 | + memcpy(h3270.obptr, dft_savebuf, dft_savebuf_len); |
541 | + h3270.obptr += dft_savebuf_len; | ||
542 | net_output(); | 542 | net_output(); |
543 | } | 543 | } |
544 | } | 544 | } |
src/lib3270/rpq.c
@@ -142,14 +142,14 @@ void do_qr_rpqnames(void) | @@ -142,14 +142,14 @@ void do_qr_rpqnames(void) | ||
142 | */ | 142 | */ |
143 | space3270out(4+4+1+remaining); /* Maximum space for an RPQNAME item */ | 143 | space3270out(4+4+1+remaining); /* Maximum space for an RPQNAME item */ |
144 | 144 | ||
145 | - SET32(obptr, 0); /* Device number, 0 = All */ | ||
146 | - SET32(obptr, 0); /* Model number, 0 = All */ | 145 | + SET32(h3270.obptr, 0); /* Device number, 0 = All */ |
146 | + SET32(h3270.obptr, 0); /* Model number, 0 = All */ | ||
147 | 147 | ||
148 | - rpql = obptr++; /* Save address to place data length. */ | 148 | + rpql = h3270.obptr++; /* Save address to place data length. */ |
149 | 149 | ||
150 | /* Create fixed length portion - program id: x3270 */ | 150 | /* Create fixed length portion - program id: x3270 */ |
151 | for (j = 0; j < 5; j++) { | 151 | for (j = 0; j < 5; j++) { |
152 | - *obptr++ = asc2ebc[(int)"x3270"[j]]; | 152 | + *h3270.obptr++ = asc2ebc[(int)"x3270"[j]]; |
153 | remaining--; | 153 | remaining--; |
154 | } | 154 | } |
155 | 155 | ||
@@ -164,11 +164,9 @@ void do_qr_rpqnames(void) | @@ -164,11 +164,9 @@ void do_qr_rpqnames(void) | ||
164 | 164 | ||
165 | term_id = rpq_keywords[j].id; | 165 | term_id = rpq_keywords[j].id; |
166 | 166 | ||
167 | - p_term = obptr; /* save starting address (to insert | ||
168 | - length later) */ | ||
169 | - obptr++; /* skip length of term, fill in | ||
170 | - later */ | ||
171 | - *obptr++ = term_id; /* identify this term */ | 167 | + p_term = h3270.obptr; /* save starting address (to insert length later) */ |
168 | + h3270.obptr++; /* skip length of term, fill in later */ | ||
169 | + *h3270.obptr++ = term_id; /* identify this term */ | ||
172 | 170 | ||
173 | /* | 171 | /* |
174 | * Adjust remaining space by the term prefix size so each case | 172 | * Adjust remaining space by the term prefix size so each case |
@@ -180,18 +178,18 @@ void do_qr_rpqnames(void) | @@ -180,18 +178,18 @@ void do_qr_rpqnames(void) | ||
180 | 178 | ||
181 | switch (term_id) { /* build the term based on id */ | 179 | switch (term_id) { /* build the term based on id */ |
182 | case RPQ_USER: /* User text from env. vars */ | 180 | case RPQ_USER: /* User text from env. vars */ |
183 | - obptr += get_rpq_user(obptr, remaining); | 181 | + h3270.obptr += get_rpq_user(h3270.obptr, remaining); |
184 | break; | 182 | break; |
185 | 183 | ||
186 | case RPQ_TIMEZONE: /* UTC time offset */ | 184 | case RPQ_TIMEZONE: /* UTC time offset */ |
187 | omit_due_space_limit = (remaining < 2); | 185 | omit_due_space_limit = (remaining < 2); |
188 | if (!omit_due_space_limit) | 186 | if (!omit_due_space_limit) |
189 | - SET16(obptr, get_rpq_timezone()); | 187 | + SET16(h3270.obptr, get_rpq_timezone()); |
190 | break; | 188 | break; |
191 | 189 | ||
192 | case RPQ_ADDRESS: /* Workstation address */ | 190 | case RPQ_ADDRESS: /* Workstation address */ |
193 | #if !defined(_WIN32) /*[*/ | 191 | #if !defined(_WIN32) /*[*/ |
194 | - obptr += get_rpq_address(obptr, remaining); | 192 | + h3270.obptr += get_rpq_address(h3270.obptr, remaining); |
195 | #endif /*]*/ | 193 | #endif /*]*/ |
196 | break; | 194 | break; |
197 | 195 | ||
@@ -200,7 +198,7 @@ void do_qr_rpqnames(void) | @@ -200,7 +198,7 @@ void do_qr_rpqnames(void) | ||
200 | omit_due_space_limit = (x > remaining); | 198 | omit_due_space_limit = (x > remaining); |
201 | if (!omit_due_space_limit) { | 199 | if (!omit_due_space_limit) { |
202 | for (i = 0; i < x; i++) { | 200 | for (i = 0; i < x; i++) { |
203 | - *obptr++ = asc2ebc[(int)(*(build_rpq_version+i) & 0xff)]; | 201 | + *h3270.obptr++ = asc2ebc[(int)(*(build_rpq_version+i) & 0xff)]; |
204 | } | 202 | } |
205 | } | 203 | } |
206 | break; | 204 | break; |
@@ -210,7 +208,7 @@ void do_qr_rpqnames(void) | @@ -210,7 +208,7 @@ void do_qr_rpqnames(void) | ||
210 | omit_due_space_limit = ((x+1)/2 > remaining); | 208 | omit_due_space_limit = ((x+1)/2 > remaining); |
211 | if (!omit_due_space_limit) { | 209 | if (!omit_due_space_limit) { |
212 | for (i=0; i < x; i+=2) { | 210 | for (i=0; i < x; i+=2) { |
213 | - *obptr++ = ((*(build_rpq_timestamp+i) - '0') << 4) | 211 | + *h3270.obptr++ = ((*(build_rpq_timestamp+i) - '0') << 4) |
214 | + (*(build_rpq_timestamp+i+1) - '0'); | 212 | + (*(build_rpq_timestamp+i+1) - '0'); |
215 | } | 213 | } |
216 | } | 214 | } |
@@ -228,14 +226,14 @@ void do_qr_rpqnames(void) | @@ -228,14 +226,14 @@ void do_qr_rpqnames(void) | ||
228 | * adjust space remaining. | 226 | * adjust space remaining. |
229 | * obptr now points at "next available byte". | 227 | * obptr now points at "next available byte". |
230 | */ | 228 | */ |
231 | - x = obptr-p_term; | 229 | + x = h3270.obptr-p_term; |
232 | if (x > TERM_PREFIX_SIZE) { | 230 | if (x > TERM_PREFIX_SIZE) { |
233 | *p_term = x; | 231 | *p_term = x; |
234 | remaining -= x; /* This includes length and id fields, | 232 | remaining -= x; /* This includes length and id fields, |
235 | correction below */ | 233 | correction below */ |
236 | } else { | 234 | } else { |
237 | /* We didn't add an item after all, reset pointer. */ | 235 | /* We didn't add an item after all, reset pointer. */ |
238 | - obptr = p_term; | 236 | + h3270.obptr = p_term; |
239 | } | 237 | } |
240 | /* | 238 | /* |
241 | * When we calculated the length of the term, a few lines | 239 | * When we calculated the length of the term, a few lines |
@@ -257,7 +255,7 @@ void do_qr_rpqnames(void) | @@ -257,7 +255,7 @@ void do_qr_rpqnames(void) | ||
257 | } | 255 | } |
258 | 256 | ||
259 | /* Fill in overall length of RPQNAME info */ | 257 | /* Fill in overall length of RPQNAME info */ |
260 | - *rpql = (obptr - rpql); | 258 | + *rpql = (h3270.obptr - rpql); |
261 | 259 | ||
262 | rpq_dump_warnings(); | 260 | rpq_dump_warnings(); |
263 | } | 261 | } |
src/lib3270/sf.c
@@ -653,9 +653,9 @@ sf_outbound_ds(unsigned char buf[], int buflen) | @@ -653,9 +653,9 @@ sf_outbound_ds(unsigned char buf[], int buflen) | ||
653 | static void | 653 | static void |
654 | query_reply_start(void) | 654 | query_reply_start(void) |
655 | { | 655 | { |
656 | - obptr = obuf; | 656 | + h3270.obptr = h3270.obuf; |
657 | space3270out(1); | 657 | space3270out(1); |
658 | - *obptr++ = AID_SF; | 658 | + *h3270.obptr++ = AID_SF; |
659 | qr_in_progress = True; | 659 | qr_in_progress = True; |
660 | } | 660 | } |
661 | 661 | ||
@@ -681,13 +681,13 @@ do_query_reply(unsigned char code) | @@ -681,13 +681,13 @@ do_query_reply(unsigned char code) | ||
681 | } | 681 | } |
682 | 682 | ||
683 | do { | 683 | do { |
684 | - int obptr0 = obptr - obuf; | 684 | + int obptr0 = h3270.obptr - h3270.obuf; |
685 | Boolean full = True; | 685 | Boolean full = True; |
686 | 686 | ||
687 | space3270out(4); | 687 | space3270out(4); |
688 | - obptr += 2; /* skip length for now */ | ||
689 | - *obptr++ = SFID_QREPLY; | ||
690 | - *obptr++ = code; | 688 | + h3270.obptr += 2; /* skip length for now */ |
689 | + *h3270.obptr++ = SFID_QREPLY; | ||
690 | + *h3270.obptr++ = code; | ||
691 | 691 | ||
692 | more = False; | 692 | more = False; |
693 | if (replies[i].single_fn) | 693 | if (replies[i].single_fn) |
@@ -700,12 +700,12 @@ do_query_reply(unsigned char code) | @@ -700,12 +700,12 @@ do_query_reply(unsigned char code) | ||
700 | unsigned char *obptr_len; | 700 | unsigned char *obptr_len; |
701 | 701 | ||
702 | /* Fill in the length. */ | 702 | /* Fill in the length. */ |
703 | - obptr_len = obuf + obptr0; | ||
704 | - len = (obptr - obuf) - obptr0; | 703 | + obptr_len = h3270.obuf + obptr0; |
704 | + len = (h3270.obptr - h3270.obuf) - obptr0; | ||
705 | SET16(obptr_len, len); | 705 | SET16(obptr_len, len); |
706 | } else { | 706 | } else { |
707 | /* Back over the header. */ | 707 | /* Back over the header. */ |
708 | - obptr -= 4; | 708 | + h3270.obptr -= 4; |
709 | } | 709 | } |
710 | } while (more); | 710 | } while (more); |
711 | } | 711 | } |
@@ -730,7 +730,7 @@ do_qr_summary(void) | @@ -730,7 +730,7 @@ do_qr_summary(void) | ||
730 | #endif /*]*/ | 730 | #endif /*]*/ |
731 | trace_ds("%s%s", comma, see_qcode(replies[i].code)); | 731 | trace_ds("%s%s", comma, see_qcode(replies[i].code)); |
732 | comma = ","; | 732 | comma = ","; |
733 | - *obptr++ = replies[i].code; | 733 | + *h3270.obptr++ = replies[i].code; |
734 | #if defined(X3270_DBCS) /*[*/ | 734 | #if defined(X3270_DBCS) /*[*/ |
735 | } | 735 | } |
736 | #endif /*]*/ | 736 | #endif /*]*/ |
@@ -745,30 +745,30 @@ do_qr_usable_area(void) | @@ -745,30 +745,30 @@ do_qr_usable_area(void) | ||
745 | 745 | ||
746 | trace_ds("> QueryReply(UsableArea)\n"); | 746 | trace_ds("> QueryReply(UsableArea)\n"); |
747 | space3270out(19); | 747 | space3270out(19); |
748 | - *obptr++ = 0x01; /* 12/14-bit addressing */ | ||
749 | - *obptr++ = 0x00; /* no special character features */ | ||
750 | - SET16(obptr, h3270.maxCOLS); /* usable width */ | ||
751 | - SET16(obptr, h3270.maxROWS); /* usable height */ | ||
752 | - *obptr++ = 0x01; /* units (mm) */ | 748 | + *h3270.obptr++ = 0x01; /* 12/14-bit addressing */ |
749 | + *h3270.obptr++ = 0x00; /* no special character features */ | ||
750 | + SET16(h3270.obptr, h3270.maxCOLS); /* usable width */ | ||
751 | + SET16(h3270.obptr, h3270.maxROWS); /* usable height */ | ||
752 | + *h3270.obptr++ = 0x01; /* units (mm) */ | ||
753 | num = display_widthMM(); | 753 | num = display_widthMM(); |
754 | denom = display_width(); | 754 | denom = display_width(); |
755 | while (!(num %2) && !(denom % 2)) { | 755 | while (!(num %2) && !(denom % 2)) { |
756 | num /= 2; | 756 | num /= 2; |
757 | denom /= 2; | 757 | denom /= 2; |
758 | } | 758 | } |
759 | - SET16(obptr, (int)num); /* Xr numerator */ | ||
760 | - SET16(obptr, (int)denom); /* Xr denominator */ | 759 | + SET16(h3270.obptr, (int)num); /* Xr numerator */ |
760 | + SET16(h3270.obptr, (int)denom); /* Xr denominator */ | ||
761 | num = display_heightMM(); | 761 | num = display_heightMM(); |
762 | denom = display_height(); | 762 | denom = display_height(); |
763 | while (!(num %2) && !(denom % 2)) { | 763 | while (!(num %2) && !(denom % 2)) { |
764 | num /= 2; | 764 | num /= 2; |
765 | denom /= 2; | 765 | denom /= 2; |
766 | } | 766 | } |
767 | - SET16(obptr, (int)num); /* Yr numerator */ | ||
768 | - SET16(obptr, (int)denom); /* Yr denominator */ | ||
769 | - *obptr++ = *char_width; /* AW */ | ||
770 | - *obptr++ = *char_height;/* AH */ | ||
771 | - SET16(obptr, h3270.maxCOLS * h3270.maxROWS); /* buffer, questionable */ | 767 | + SET16(h3270.obptr, (int)num); /* Yr numerator */ |
768 | + SET16(h3270.obptr, (int)denom); /* Yr denominator */ | ||
769 | + *h3270.obptr++ = *char_width; /* AW */ | ||
770 | + *h3270.obptr++ = *char_height;/* AH */ | ||
771 | + SET16(h3270.obptr, h3270.maxCOLS * h3270.maxROWS); /* buffer, questionable */ | ||
772 | } | 772 | } |
773 | 773 | ||
774 | static void | 774 | static void |
@@ -782,16 +782,16 @@ do_qr_color(void) | @@ -782,16 +782,16 @@ do_qr_color(void) | ||
782 | color_max = h3270.color8 ? 8: 16; /* report on 8 or 16 colors */ | 782 | color_max = h3270.color8 ? 8: 16; /* report on 8 or 16 colors */ |
783 | 783 | ||
784 | space3270out(4 + 2*15); | 784 | space3270out(4 + 2*15); |
785 | - *obptr++ = 0x00; /* no options */ | ||
786 | - *obptr++ = color_max; /* report on 8 or 16 colors */ | ||
787 | - *obptr++ = 0x00; /* default color: */ | ||
788 | - *obptr++ = 0xf0 + COLOR_GREEN; /* green */ | 785 | + *h3270.obptr++ = 0x00; /* no options */ |
786 | + *h3270.obptr++ = color_max; /* report on 8 or 16 colors */ | ||
787 | + *h3270.obptr++ = 0x00; /* default color: */ | ||
788 | + *h3270.obptr++ = 0xf0 + COLOR_GREEN; /* green */ | ||
789 | for (i = 0xf1; i < 0xf1 + color_max - 1; i++) { | 789 | for (i = 0xf1; i < 0xf1 + color_max - 1; i++) { |
790 | - *obptr++ = i; | 790 | + *h3270.obptr++ = i; |
791 | if (h3270.m3279) | 791 | if (h3270.m3279) |
792 | - *obptr++ = i; | 792 | + *h3270.obptr++ = i; |
793 | else | 793 | else |
794 | - *obptr++ = 0x00; | 794 | + *h3270.obptr++ = 0x00; |
795 | } | 795 | } |
796 | 796 | ||
797 | /* | 797 | /* |
@@ -813,17 +813,17 @@ do_qr_highlighting(void) | @@ -813,17 +813,17 @@ do_qr_highlighting(void) | ||
813 | { | 813 | { |
814 | trace_ds("> QueryReply(Highlighting)\n"); | 814 | trace_ds("> QueryReply(Highlighting)\n"); |
815 | space3270out(11); | 815 | space3270out(11); |
816 | - *obptr++ = 5; /* report on 5 pairs */ | ||
817 | - *obptr++ = XAH_DEFAULT; /* default: */ | ||
818 | - *obptr++ = XAH_NORMAL; /* normal */ | ||
819 | - *obptr++ = XAH_BLINK; /* blink: */ | ||
820 | - *obptr++ = XAH_BLINK; /* blink */ | ||
821 | - *obptr++ = XAH_REVERSE; /* reverse: */ | ||
822 | - *obptr++ = XAH_REVERSE; /* reverse */ | ||
823 | - *obptr++ = XAH_UNDERSCORE; /* underscore: */ | ||
824 | - *obptr++ = XAH_UNDERSCORE; /* underscore */ | ||
825 | - *obptr++ = XAH_INTENSIFY; /* intensify: */ | ||
826 | - *obptr++ = XAH_INTENSIFY; /* intensify */ | 816 | + *h3270.obptr++ = 5; /* report on 5 pairs */ |
817 | + *h3270.obptr++ = XAH_DEFAULT; /* default: */ | ||
818 | + *h3270.obptr++ = XAH_NORMAL; /* normal */ | ||
819 | + *h3270.obptr++ = XAH_BLINK; /* blink: */ | ||
820 | + *h3270.obptr++ = XAH_BLINK; /* blink */ | ||
821 | + *h3270.obptr++ = XAH_REVERSE; /* reverse: */ | ||
822 | + *h3270.obptr++ = XAH_REVERSE; /* reverse */ | ||
823 | + *h3270.obptr++ = XAH_UNDERSCORE; /* underscore: */ | ||
824 | + *h3270.obptr++ = XAH_UNDERSCORE; /* underscore */ | ||
825 | + *h3270.obptr++ = XAH_INTENSIFY; /* intensify: */ | ||
826 | + *h3270.obptr++ = XAH_INTENSIFY; /* intensify */ | ||
827 | } | 827 | } |
828 | 828 | ||
829 | static void | 829 | static void |
@@ -831,9 +831,9 @@ do_qr_reply_modes(void) | @@ -831,9 +831,9 @@ do_qr_reply_modes(void) | ||
831 | { | 831 | { |
832 | trace_ds("> QueryReply(ReplyModes)\n"); | 832 | trace_ds("> QueryReply(ReplyModes)\n"); |
833 | space3270out(3); | 833 | space3270out(3); |
834 | - *obptr++ = SF_SRM_FIELD; | ||
835 | - *obptr++ = SF_SRM_XFIELD; | ||
836 | - *obptr++ = SF_SRM_CHAR; | 834 | + *h3270.obptr++ = SF_SRM_FIELD; |
835 | + *h3270.obptr++ = SF_SRM_XFIELD; | ||
836 | + *h3270.obptr++ = SF_SRM_CHAR; | ||
837 | } | 837 | } |
838 | 838 | ||
839 | #if defined(X3270_DBCS) /*[*/ | 839 | #if defined(X3270_DBCS) /*[*/ |
@@ -858,9 +858,9 @@ do_qr_alpha_part(void) | @@ -858,9 +858,9 @@ do_qr_alpha_part(void) | ||
858 | { | 858 | { |
859 | trace_ds("> QueryReply(AlphanumericPartitions)\n"); | 859 | trace_ds("> QueryReply(AlphanumericPartitions)\n"); |
860 | space3270out(4); | 860 | space3270out(4); |
861 | - *obptr++ = 0; /* 1 partition */ | ||
862 | - SET16(obptr, h3270.maxROWS * h3270.maxCOLS); /* buffer space */ | ||
863 | - *obptr++ = 0; /* no special features */ | 861 | + *h3270.obptr++ = 0; /* 1 partition */ |
862 | + SET16(h3270.obptr, h3270.maxROWS * h3270.maxCOLS); /* buffer space */ | ||
863 | + *h3270.obptr++ = 0; /* no special features */ | ||
864 | } | 864 | } |
865 | 865 | ||
866 | static void | 866 | static void |
@@ -870,35 +870,36 @@ do_qr_charsets(void) | @@ -870,35 +870,36 @@ do_qr_charsets(void) | ||
870 | space3270out(64); | 870 | space3270out(64); |
871 | #if defined(X3270_DBCS) /*[*/ | 871 | #if defined(X3270_DBCS) /*[*/ |
872 | if (dbcs) | 872 | if (dbcs) |
873 | - *obptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */ | 873 | + *h3270.obptr++ = 0x8e; /* flags: GE, CGCSGID, DBCS */ |
874 | else | 874 | else |
875 | #endif /*]*/ | 875 | #endif /*]*/ |
876 | - *obptr++ = 0x82; /* flags: GE, CGCSGID present */ | ||
877 | - *obptr++ = 0x00; /* more flags */ | ||
878 | - *obptr++ = *char_width; /* SDW */ | ||
879 | - *obptr++ = *char_height; /* SDW */ | ||
880 | - *obptr++ = 0x00; /* no load PS */ | ||
881 | - *obptr++ = 0x00; | ||
882 | - *obptr++ = 0x00; | ||
883 | - *obptr++ = 0x00; | 876 | + *h3270.obptr++ = 0x82; /* flags: GE, CGCSGID present */ |
877 | + | ||
878 | + *h3270.obptr++ = 0x00; /* more flags */ | ||
879 | + *h3270.obptr++ = *char_width; /* SDW */ | ||
880 | + *h3270.obptr++ = *char_height; /* SDW */ | ||
881 | + *h3270.obptr++ = 0x00; /* no load PS */ | ||
882 | + *h3270.obptr++ = 0x00; | ||
883 | + *h3270.obptr++ = 0x00; | ||
884 | + *h3270.obptr++ = 0x00; | ||
884 | #if defined(X3270_DBCS) /*[*/ | 885 | #if defined(X3270_DBCS) /*[*/ |
885 | if (dbcs) | 886 | if (dbcs) |
886 | - *obptr++ = 0x0b; /* DL (11 bytes) */ | 887 | + *h3270.obptr++ = 0x0b; /* DL (11 bytes) */ |
887 | else | 888 | else |
888 | #endif /*]*/ | 889 | #endif /*]*/ |
889 | - *obptr++ = 0x07; /* DL (7 bytes) */ | 890 | + *h3270.obptr++ = 0x07; /* DL (7 bytes) */ |
890 | 891 | ||
891 | - *obptr++ = 0x00; /* SET 0: */ | 892 | + *h3270.obptr++ = 0x00; /* SET 0: */ |
892 | #if defined(X3270_DBCS) /*[*/ | 893 | #if defined(X3270_DBCS) /*[*/ |
893 | if (dbcs) | 894 | if (dbcs) |
894 | - *obptr++ = 0x00; /* FLAGS: non-load, single- | 895 | + *h3270.obptr++ = 0x00; /* FLAGS: non-load, single- |
895 | plane, single-bute */ | 896 | plane, single-bute */ |
896 | else | 897 | else |
897 | #endif /*]*/ | 898 | #endif /*]*/ |
898 | - *obptr++ = 0x10; /* FLAGS: non-loadable, | 899 | + *h3270.obptr++ = 0x10; /* FLAGS: non-loadable, |
899 | single-plane, single-byte, | 900 | single-plane, single-byte, |
900 | no compare */ | 901 | no compare */ |
901 | - *obptr++ = 0x00; /* LCID 0 */ | 902 | + *h3270.obptr++ = 0x00; /* LCID 0 */ |
902 | #if defined(X3270_DBCS) /*[*/ | 903 | #if defined(X3270_DBCS) /*[*/ |
903 | if (dbcs) { | 904 | if (dbcs) { |
904 | *obptr++ = 0x00; /* SW 0 */ | 905 | *obptr++ = 0x00; /* SW 0 */ |
@@ -907,17 +908,17 @@ do_qr_charsets(void) | @@ -907,17 +908,17 @@ do_qr_charsets(void) | ||
907 | *obptr++ = 0x00; /* SUBSN */ | 908 | *obptr++ = 0x00; /* SUBSN */ |
908 | } | 909 | } |
909 | #endif /*]*/ | 910 | #endif /*]*/ |
910 | - SET32(obptr, cgcsgid); /* CGCSGID */ | 911 | + SET32(h3270.obptr, cgcsgid); /* CGCSGID */ |
911 | if (!*standard_font) { | 912 | if (!*standard_font) { |
912 | /* special 3270 font, includes APL */ | 913 | /* special 3270 font, includes APL */ |
913 | - *obptr++ = 0x01;/* SET 1: */ | 914 | + *h3270.obptr++ = 0x01;/* SET 1: */ |
914 | if (h3270.apl_mode) | 915 | if (h3270.apl_mode) |
915 | - *obptr++ = 0x00;/* FLAGS: non-loadable, single-plane, | 916 | + *h3270.obptr++ = 0x00;/* FLAGS: non-loadable, single-plane, |
916 | single-byte, no compare */ | 917 | single-byte, no compare */ |
917 | else | 918 | else |
918 | - *obptr++ = 0x10;/* FLAGS: non-loadable, single-plane, | 919 | + *h3270.obptr++ = 0x10;/* FLAGS: non-loadable, single-plane, |
919 | single-byte, no compare */ | 920 | single-byte, no compare */ |
920 | - *obptr++ = 0xf1;/* LCID */ | 921 | + *h3270.obptr++ = 0xf1;/* LCID */ |
921 | #if defined(X3270_DBCS) /*[*/ | 922 | #if defined(X3270_DBCS) /*[*/ |
922 | if (dbcs) { | 923 | if (dbcs) { |
923 | *obptr++ = 0x00;/* SW 0 */ | 924 | *obptr++ = 0x00;/* SW 0 */ |
@@ -926,10 +927,10 @@ do_qr_charsets(void) | @@ -926,10 +927,10 @@ do_qr_charsets(void) | ||
926 | *obptr++ = 0x00;/* SUBSN */ | 927 | *obptr++ = 0x00;/* SUBSN */ |
927 | } | 928 | } |
928 | #endif /*]*/ | 929 | #endif /*]*/ |
929 | - *obptr++ = 0x03;/* CGCSGID: 3179-style APL2 */ | ||
930 | - *obptr++ = 0xc3; | ||
931 | - *obptr++ = 0x01; | ||
932 | - *obptr++ = 0x36; | 930 | + *h3270.obptr++ = 0x03;/* CGCSGID: 3179-style APL2 */ |
931 | + *h3270.obptr++ = 0xc3; | ||
932 | + *h3270.obptr++ = 0x01; | ||
933 | + *h3270.obptr++ = 0x36; | ||
933 | } | 934 | } |
934 | #if defined(X3270_DBCS) /*[*/ | 935 | #if defined(X3270_DBCS) /*[*/ |
935 | if (dbcs) { | 936 | if (dbcs) { |
@@ -953,10 +954,10 @@ do_qr_ddm(void) | @@ -953,10 +954,10 @@ do_qr_ddm(void) | ||
953 | 954 | ||
954 | trace_ds("> QueryReply(DistributedDataManagement)\n"); | 955 | trace_ds("> QueryReply(DistributedDataManagement)\n"); |
955 | space3270out(8); | 956 | space3270out(8); |
956 | - SET16(obptr,0); /* set reserved field to 0 */ | ||
957 | - SET16(obptr, dft_buffersize); /* set inbound length limit INLIM */ | ||
958 | - SET16(obptr, dft_buffersize); /* set outbound length limit OUTLIM */ | ||
959 | - SET16(obptr, 0x0101); /* NSS=01, DDMSS=01 */ | 957 | + SET16(h3270.obptr,0); /* set reserved field to 0 */ |
958 | + SET16(h3270.obptr, dft_buffersize); /* set inbound length limit INLIM */ | ||
959 | + SET16(h3270.obptr, dft_buffersize); /* set outbound length limit OUTLIM */ | ||
960 | + SET16(h3270.obptr, 0x0101); /* NSS=01, DDMSS=01 */ | ||
960 | } | 961 | } |
961 | #endif /*]*/ | 962 | #endif /*]*/ |
962 | 963 | ||
@@ -965,15 +966,15 @@ do_qr_imp_part(void) | @@ -965,15 +966,15 @@ do_qr_imp_part(void) | ||
965 | { | 966 | { |
966 | trace_ds("> QueryReply(ImplicitPartition)\n"); | 967 | trace_ds("> QueryReply(ImplicitPartition)\n"); |
967 | space3270out(13); | 968 | space3270out(13); |
968 | - *obptr++ = 0x0; /* reserved */ | ||
969 | - *obptr++ = 0x0; | ||
970 | - *obptr++ = 0x0b; /* length of display size */ | ||
971 | - *obptr++ = 0x01; /* "implicit partition size" */ | ||
972 | - *obptr++ = 0x00; /* reserved */ | ||
973 | - SET16(obptr, 80); /* implicit partition width */ | ||
974 | - SET16(obptr, 24); /* implicit partition height */ | ||
975 | - SET16(obptr, h3270.maxCOLS); /* alternate height */ | ||
976 | - SET16(obptr, h3270.maxROWS); /* alternate width */ | 969 | + *h3270.obptr++ = 0x0; /* reserved */ |
970 | + *h3270.obptr++ = 0x0; | ||
971 | + *h3270.obptr++ = 0x0b; /* length of display size */ | ||
972 | + *h3270.obptr++ = 0x01; /* "implicit partition size" */ | ||
973 | + *h3270.obptr++ = 0x00; /* reserved */ | ||
974 | + SET16(h3270.obptr, 80); /* implicit partition width */ | ||
975 | + SET16(h3270.obptr, 24); /* implicit partition height */ | ||
976 | + SET16(h3270.obptr, h3270.maxCOLS); /* alternate height */ | ||
977 | + SET16(h3270.obptr, h3270.maxROWS); /* alternate width */ | ||
977 | } | 978 | } |
978 | 979 | ||
979 | static void | 980 | static void |
src/lib3270/telnet.c
@@ -121,8 +121,8 @@ int ns_brcvd; | @@ -121,8 +121,8 @@ int ns_brcvd; | ||
121 | int ns_rrcvd; | 121 | int ns_rrcvd; |
122 | int ns_bsent; | 122 | int ns_bsent; |
123 | int ns_rsent; | 123 | int ns_rsent; |
124 | -unsigned char *obuf; /* 3270 output buffer */ | ||
125 | -unsigned char *obptr = (unsigned char *) NULL; | 124 | +// unsigned char *obuf; /* 3270 output buffer */ |
125 | +// unsigned char *obptr = (unsigned char *) NULL; | ||
126 | int linemode = 1; | 126 | int linemode = 1; |
127 | 127 | ||
128 | /* | 128 | /* |
@@ -2520,7 +2520,7 @@ void space3270out(int n) | @@ -2520,7 +2520,7 @@ void space3270out(int n) | ||
2520 | unsigned more = 0; | 2520 | unsigned more = 0; |
2521 | 2521 | ||
2522 | if (obuf_size) | 2522 | if (obuf_size) |
2523 | - nc = obptr - obuf; | 2523 | + nc = h3270.obptr - h3270.obuf; |
2524 | 2524 | ||
2525 | while ((nc + n + EH_SIZE) > (obuf_size + more)) { | 2525 | while ((nc + n + EH_SIZE) > (obuf_size + more)) { |
2526 | more += BUFSIZ; | 2526 | more += BUFSIZ; |
@@ -2530,8 +2530,8 @@ void space3270out(int n) | @@ -2530,8 +2530,8 @@ void space3270out(int n) | ||
2530 | obuf_size += more; | 2530 | obuf_size += more; |
2531 | obuf_base = (unsigned char *)Realloc((char *)obuf_base, | 2531 | obuf_base = (unsigned char *)Realloc((char *)obuf_base, |
2532 | obuf_size); | 2532 | obuf_size); |
2533 | - obuf = obuf_base + EH_SIZE; | ||
2534 | - obptr = obuf + nc; | 2533 | + h3270.obuf = obuf_base + EH_SIZE; |
2534 | + h3270.obptr = h3270.obuf + nc; | ||
2535 | } | 2535 | } |
2536 | } | 2536 | } |
2537 | 2537 | ||
@@ -2669,7 +2669,7 @@ net_output(void) | @@ -2669,7 +2669,7 @@ net_output(void) | ||
2669 | unsigned char *nxoptr, *xoptr; | 2669 | unsigned char *nxoptr, *xoptr; |
2670 | 2670 | ||
2671 | #if defined(X3270_TN3270E) /*[*/ | 2671 | #if defined(X3270_TN3270E) /*[*/ |
2672 | -#define BSTART ((IN_TN3270E || IN_SSCP) ? obuf_base : obuf) | 2672 | +#define BSTART ((IN_TN3270E || IN_SSCP) ? obuf_base : h3270.obuf) |
2673 | #else /*][*/ | 2673 | #else /*][*/ |
2674 | #define BSTART obuf | 2674 | #define BSTART obuf |
2675 | #endif /*]*/ | 2675 | #endif /*]*/ |
@@ -2701,7 +2701,7 @@ net_output(void) | @@ -2701,7 +2701,7 @@ net_output(void) | ||
2701 | #endif /*]*/ | 2701 | #endif /*]*/ |
2702 | 2702 | ||
2703 | /* Reallocate the expanded output buffer. */ | 2703 | /* Reallocate the expanded output buffer. */ |
2704 | - while (xobuf_len < (obptr - BSTART + 1) * 2) { | 2704 | + while (xobuf_len < (h3270.obptr - BSTART + 1) * 2) { |
2705 | xobuf_len += BUFSZ; | 2705 | xobuf_len += BUFSZ; |
2706 | need_resize++; | 2706 | need_resize++; |
2707 | } | 2707 | } |
@@ -2712,7 +2712,7 @@ net_output(void) | @@ -2712,7 +2712,7 @@ net_output(void) | ||
2712 | /* Copy and expand IACs. */ | 2712 | /* Copy and expand IACs. */ |
2713 | xoptr = xobuf; | 2713 | xoptr = xobuf; |
2714 | nxoptr = BSTART; | 2714 | nxoptr = BSTART; |
2715 | - while (nxoptr < obptr) { | 2715 | + while (nxoptr < h3270.obptr) { |
2716 | if ((*xoptr++ = *nxoptr++) == IAC) { | 2716 | if ((*xoptr++ = *nxoptr++) == IAC) { |
2717 | *xoptr++ = IAC; | 2717 | *xoptr++ = IAC; |
2718 | } | 2718 | } |
@@ -2802,7 +2802,7 @@ net_add_dummy_tn3270e(void) | @@ -2802,7 +2802,7 @@ net_add_dummy_tn3270e(void) | ||
2802 | return False; | 2802 | return False; |
2803 | 2803 | ||
2804 | space3270out(EH_SIZE); | 2804 | space3270out(EH_SIZE); |
2805 | - h = (tn3270e_header *)obptr; | 2805 | + h = (tn3270e_header *)h3270.obptr; |
2806 | 2806 | ||
2807 | switch (tn3270e_submode) { | 2807 | switch (tn3270e_submode) { |
2808 | case E_NONE: | 2808 | case E_NONE: |
@@ -2821,7 +2821,7 @@ net_add_dummy_tn3270e(void) | @@ -2821,7 +2821,7 @@ net_add_dummy_tn3270e(void) | ||
2821 | h->response_flag = TN3270E_RSF_NO_RESPONSE; | 2821 | h->response_flag = TN3270E_RSF_NO_RESPONSE; |
2822 | h->seq_number[0] = 0; | 2822 | h->seq_number[0] = 0; |
2823 | h->seq_number[1] = 0; | 2823 | h->seq_number[1] = 0; |
2824 | - obptr += EH_SIZE; | 2824 | + h3270.obptr += EH_SIZE; |
2825 | return True; | 2825 | return True; |
2826 | } | 2826 | } |
2827 | #endif /*]*/ | 2827 | #endif /*]*/ |
@@ -3085,7 +3085,7 @@ net_snap_options(void) | @@ -3085,7 +3085,7 @@ net_snap_options(void) | ||
3085 | if (!CONNECTED) | 3085 | if (!CONNECTED) |
3086 | return False; | 3086 | return False; |
3087 | 3087 | ||
3088 | - obptr = obuf; | 3088 | + h3270.obptr = h3270.obuf; |
3089 | 3089 | ||
3090 | /* Do TTYPE first. */ | 3090 | /* Do TTYPE first. */ |
3091 | if (h3270.myopts[TELOPT_TTYPE]) { | 3091 | if (h3270.myopts[TELOPT_TTYPE]) { |
@@ -3093,7 +3093,7 @@ net_snap_options(void) | @@ -3093,7 +3093,7 @@ net_snap_options(void) | ||
3093 | 3093 | ||
3094 | space3270out(sizeof(ttype_str)); | 3094 | space3270out(sizeof(ttype_str)); |
3095 | for (j = 0; j < sizeof(ttype_str); j++) | 3095 | for (j = 0; j < sizeof(ttype_str); j++) |
3096 | - *obptr++ = ttype_str[j]; | 3096 | + *h3270.obptr++ = ttype_str[j]; |
3097 | } | 3097 | } |
3098 | 3098 | ||
3099 | /* Do the other options. */ | 3099 | /* Do the other options. */ |
@@ -3102,15 +3102,15 @@ net_snap_options(void) | @@ -3102,15 +3102,15 @@ net_snap_options(void) | ||
3102 | if (i == TELOPT_TTYPE) | 3102 | if (i == TELOPT_TTYPE) |
3103 | continue; | 3103 | continue; |
3104 | if (h3270.hisopts[i]) { | 3104 | if (h3270.hisopts[i]) { |
3105 | - *obptr++ = IAC; | ||
3106 | - *obptr++ = WILL; | ||
3107 | - *obptr++ = (unsigned char)i; | 3105 | + *h3270.obptr++ = IAC; |
3106 | + *h3270.obptr++ = WILL; | ||
3107 | + *h3270.obptr++ = (unsigned char)i; | ||
3108 | any = True; | 3108 | any = True; |
3109 | } | 3109 | } |
3110 | if (h3270.myopts[i]) { | 3110 | if (h3270.myopts[i]) { |
3111 | - *obptr++ = IAC; | ||
3112 | - *obptr++ = DO; | ||
3113 | - *obptr++ = (unsigned char)i; | 3111 | + *h3270.obptr++ = IAC; |
3112 | + *h3270.obptr++ = DO; | ||
3113 | + *h3270.obptr++ = (unsigned char)i; | ||
3114 | any = True; | 3114 | any = True; |
3115 | } | 3115 | } |
3116 | } | 3116 | } |
@@ -3124,50 +3124,48 @@ net_snap_options(void) | @@ -3124,50 +3124,48 @@ net_snap_options(void) | ||
3124 | ((h3270.connected_type != CN) ? strlen(h3270.connected_type) : 0) + | 3124 | ((h3270.connected_type != CN) ? strlen(h3270.connected_type) : 0) + |
3125 | ((h3270.connected_lu != CN) ? + strlen(h3270.connected_lu) : 0) + | 3125 | ((h3270.connected_lu != CN) ? + strlen(h3270.connected_lu) : 0) + |
3126 | 2); | 3126 | 2); |
3127 | - *obptr++ = IAC; | ||
3128 | - *obptr++ = SB; | ||
3129 | - *obptr++ = TELOPT_TN3270E; | ||
3130 | - *obptr++ = TN3270E_OP_DEVICE_TYPE; | ||
3131 | - *obptr++ = TN3270E_OP_IS; | 3127 | + *h3270.obptr++ = IAC; |
3128 | + *h3270.obptr++ = SB; | ||
3129 | + *h3270.obptr++ = TELOPT_TN3270E; | ||
3130 | + *h3270.obptr++ = TN3270E_OP_DEVICE_TYPE; | ||
3131 | + *h3270.obptr++ = TN3270E_OP_IS; | ||
3132 | if (h3270.connected_type != CN) { | 3132 | if (h3270.connected_type != CN) { |
3133 | - (void) memcpy(obptr, h3270.connected_type, | ||
3134 | - strlen(h3270.connected_type)); | ||
3135 | - obptr += strlen(h3270.connected_type); | 3133 | + (void) memcpy(h3270.obptr, h3270.connected_type,strlen(h3270.connected_type)); |
3134 | + h3270.obptr += strlen(h3270.connected_type); | ||
3136 | } | 3135 | } |
3137 | if (h3270.connected_lu != CN) { | 3136 | if (h3270.connected_lu != CN) { |
3138 | - *obptr++ = TN3270E_OP_CONNECT; | ||
3139 | - (void) memcpy(obptr, h3270.connected_lu, | ||
3140 | - strlen(h3270.connected_lu)); | ||
3141 | - obptr += strlen(h3270.connected_lu); | 3137 | + *h3270.obptr++ = TN3270E_OP_CONNECT; |
3138 | + (void) memcpy(h3270.obptr, h3270.connected_lu,strlen(h3270.connected_lu)); | ||
3139 | + h3270.obptr += strlen(h3270.connected_lu); | ||
3142 | } | 3140 | } |
3143 | - *obptr++ = IAC; | ||
3144 | - *obptr++ = SE; | 3141 | + *h3270.obptr++ = IAC; |
3142 | + *h3270.obptr++ = SE; | ||
3145 | 3143 | ||
3146 | space3270out(38); | 3144 | space3270out(38); |
3147 | - (void) memcpy(obptr, functions_req, 4); | ||
3148 | - obptr += 4; | ||
3149 | - *obptr++ = TN3270E_OP_IS; | 3145 | + (void) memcpy(h3270.obptr, functions_req, 4); |
3146 | + h3270.obptr += 4; | ||
3147 | + *h3270.obptr++ = TN3270E_OP_IS; | ||
3150 | for (i = 0; i < 32; i++) { | 3148 | for (i = 0; i < 32; i++) { |
3151 | if (e_funcs & E_OPT(i)) | 3149 | if (e_funcs & E_OPT(i)) |
3152 | - *obptr++ = i; | 3150 | + *h3270.obptr++ = i; |
3153 | } | 3151 | } |
3154 | - *obptr++ = IAC; | ||
3155 | - *obptr++ = SE; | 3152 | + *h3270.obptr++ = IAC; |
3153 | + *h3270.obptr++ = SE; | ||
3156 | 3154 | ||
3157 | if (tn3270e_bound) { | 3155 | if (tn3270e_bound) { |
3158 | tn3270e_header *h; | 3156 | tn3270e_header *h; |
3159 | 3157 | ||
3160 | space3270out(EH_SIZE + 3); | 3158 | space3270out(EH_SIZE + 3); |
3161 | - h = (tn3270e_header *)obptr; | 3159 | + h = (tn3270e_header *)h3270.obptr; |
3162 | h->data_type = TN3270E_DT_BIND_IMAGE; | 3160 | h->data_type = TN3270E_DT_BIND_IMAGE; |
3163 | h->request_flag = 0; | 3161 | h->request_flag = 0; |
3164 | h->response_flag = 0; | 3162 | h->response_flag = 0; |
3165 | h->seq_number[0] = 0; | 3163 | h->seq_number[0] = 0; |
3166 | h->seq_number[1] = 0; | 3164 | h->seq_number[1] = 0; |
3167 | - obptr += EH_SIZE; | ||
3168 | - *obptr++ = 1; /* dummy */ | ||
3169 | - *obptr++ = IAC; | ||
3170 | - *obptr++ = EOR; | 3165 | + h3270.obptr += EH_SIZE; |
3166 | + *h3270.obptr++ = 1; /* dummy */ | ||
3167 | + *h3270.obptr++ = IAC; | ||
3168 | + *h3270.obptr++ = EOR; | ||
3171 | } | 3169 | } |
3172 | } | 3170 | } |
3173 | #endif /*]*/ | 3171 | #endif /*]*/ |
src/lib3270/telnetc.h
@@ -20,8 +20,8 @@ | @@ -20,8 +20,8 @@ | ||
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* Output buffer. */ | 22 | /* Output buffer. */ |
23 | -extern unsigned char *obuf; | ||
24 | -extern unsigned char *obptr; | 23 | +// extern unsigned char *obuf; |
24 | +// extern unsigned char *obptr; | ||
25 | 25 | ||
26 | /* Spelled-out tty control character. */ | 26 | /* Spelled-out tty control character. */ |
27 | struct ctl_char { | 27 | struct ctl_char { |