Commit ac822686e0074f263426c15943b752f6540b418d
1 parent
3f7ea0a5
Exists in
master
and in
3 other branches
Ajustando biblioteca para geração da jni android
Showing
20 changed files
with
367 additions
and
320 deletions
Show diff stats
ansi.c
| @@ -1706,10 +1706,9 @@ trace_pending_mb(void) | @@ -1706,10 +1706,9 @@ trace_pending_mb(void) | ||
| 1706 | * External entry points | 1706 | * External entry points |
| 1707 | */ | 1707 | */ |
| 1708 | 1708 | ||
| 1709 | -void | ||
| 1710 | -ansi_init(void) | 1709 | +void ansi_init(void) |
| 1711 | { | 1710 | { |
| 1712 | - register_schange(ST_3270_MODE, ansi_in3270); | 1711 | + lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,ansi_in3270,NULL); |
| 1713 | } | 1712 | } |
| 1714 | 1713 | ||
| 1715 | void | 1714 | void |
| @@ -1723,7 +1722,7 @@ ansi_process(unsigned int c) | @@ -1723,7 +1722,7 @@ ansi_process(unsigned int c) | ||
| 1723 | // scroll_to_bottom(); | 1722 | // scroll_to_bottom(); |
| 1724 | 1723 | ||
| 1725 | #if defined(X3270_TRACE) /*[*/ | 1724 | #if defined(X3270_TRACE) /*[*/ |
| 1726 | - if (toggled(SCREEN_TRACE)) | 1725 | + if (lib3270_get_toggle(&h3270,SCREEN_TRACE)) |
| 1727 | trace_char((char)c); | 1726 | trace_char((char)c); |
| 1728 | #endif /*]*/ | 1727 | #endif /*]*/ |
| 1729 | 1728 | ||
| @@ -1827,7 +1826,7 @@ ansi_send_pa(int nn) | @@ -1827,7 +1826,7 @@ ansi_send_pa(int nn) | ||
| 1827 | 1826 | ||
| 1828 | void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type unused) | 1827 | void toggle_lineWrap(H3270 *session, struct lib3270_toggle *t unused, LIB3270_TOGGLE_TYPE type unused) |
| 1829 | { | 1828 | { |
| 1830 | - if (toggled(LIB3270_TOGGLE_LINE_WRAP)) | 1829 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_LINE_WRAP)) |
| 1831 | wraparound_mode = 1; | 1830 | wraparound_mode = 1; |
| 1832 | else | 1831 | else |
| 1833 | wraparound_mode = 0; | 1832 | wraparound_mode = 0; |
| @@ -114,8 +114,8 @@ | @@ -114,8 +114,8 @@ | ||
| 114 | 114 | ||
| 115 | #define ST_RESOLVING LIB3270_STATE_RESOLVING | 115 | #define ST_RESOLVING LIB3270_STATE_RESOLVING |
| 116 | #define ST_HALF_CONNECT LIB3270_STATE_HALF_CONNECT | 116 | #define ST_HALF_CONNECT LIB3270_STATE_HALF_CONNECT |
| 117 | - #define ST_CONNECT LIB3270_STATE_CONNECT | ||
| 118 | - #define ST_3270_MODE LIB3270_STATE_3270_MODE | 117 | +// #define ST_CONNECT LIB3270_STATE_CONNECT |
| 118 | +// #define ST_3270_MODE LIB3270_STATE_3270_MODE | ||
| 119 | #define ST_LINE_MODE LIB3270_STATE_LINE_MODE | 119 | #define ST_LINE_MODE LIB3270_STATE_LINE_MODE |
| 120 | #define ST_REMODEL LIB3270_STATE_REMODEL | 120 | #define ST_REMODEL LIB3270_STATE_REMODEL |
| 121 | #define ST_PRINTER LIB3270_STATE_PRINTER | 121 | #define ST_PRINTER LIB3270_STATE_PRINTER |
| @@ -159,7 +159,7 @@ | @@ -159,7 +159,7 @@ | ||
| 159 | #define OIA_FLAG_UNDERA LIB3270_FLAG_UNDERA | 159 | #define OIA_FLAG_UNDERA LIB3270_FLAG_UNDERA |
| 160 | // #define OIA_FLAG_SECURE LIB3270_FLAG_SECURE | 160 | // #define OIA_FLAG_SECURE LIB3270_FLAG_SECURE |
| 161 | #define OIA_FLAG_TYPEAHEAD LIB3270_FLAG_TYPEAHEAD | 161 | #define OIA_FLAG_TYPEAHEAD LIB3270_FLAG_TYPEAHEAD |
| 162 | - #define OIA_FLAG_PRINTER LIB3270_FLAG_PRINTER | 162 | +// #define OIA_FLAG_PRINTER LIB3270_FLAG_PRINTER |
| 163 | #define OIA_FLAG_REVERSE LIB3270_FLAG_REVERSE | 163 | #define OIA_FLAG_REVERSE LIB3270_FLAG_REVERSE |
| 164 | #define OIA_FLAG_USER LIB3270_FLAG_COUNT | 164 | #define OIA_FLAG_USER LIB3270_FLAG_COUNT |
| 165 | #define OIA_FLAG LIB3270_FLAG | 165 | #define OIA_FLAG LIB3270_FLAG |
| @@ -382,7 +382,7 @@ | @@ -382,7 +382,7 @@ | ||
| 382 | 382 | ||
| 383 | LOCAL_EXTERN SCRIPT_STATE status_script(SCRIPT_STATE state); | 383 | LOCAL_EXTERN SCRIPT_STATE status_script(SCRIPT_STATE state); |
| 384 | 384 | ||
| 385 | - #define Toggled(ix) lib3270_get_toggle(NULL,ix) | 385 | +// #define Toggled(ix) lib3270_get_toggle(NULL,ix) |
| 386 | // #define CallAndWait(c,h,p) lib3270_call_thread(c,h,p) | 386 | // #define CallAndWait(c,h,p) lib3270_call_thread(c,h,p) |
| 387 | 387 | ||
| 388 | // #define RunPendingEvents(x) lib3270_main_iterate(x) | 388 | // #define RunPendingEvents(x) lib3270_main_iterate(x) |
| @@ -401,7 +401,7 @@ | @@ -401,7 +401,7 @@ | ||
| 401 | #define host_connect(n,wait) lib3270_connect(NULL,n,wait) | 401 | #define host_connect(n,wait) lib3270_connect(NULL,n,wait) |
| 402 | #define host_reconnect(w) lib3270_reconnect(NULL,w) | 402 | #define host_reconnect(w) lib3270_reconnect(NULL,w) |
| 403 | 403 | ||
| 404 | - #define register_schange(tx,func) lib3270_register_schange(NULL,tx,func,NULL) | 404 | +// #define register_schange(tx,func) lib3270_register_schange(NULL,tx,func,NULL) |
| 405 | 405 | ||
| 406 | /* Console/Trace window */ | 406 | /* Console/Trace window */ |
| 407 | // LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label); | 407 | // LOCAL_EXTERN HCONSOLE console_window_new(const char *title, const char *label); |
appres.h
| @@ -80,24 +80,24 @@ typedef struct { | @@ -80,24 +80,24 @@ typedef struct { | ||
| 80 | // char curses_keypad; | 80 | // char curses_keypad; |
| 81 | // char cbreak_mode; | 81 | // char cbreak_mode; |
| 82 | //#endif /*]*/ | 82 | //#endif /*]*/ |
| 83 | - char apl_mode; | 83 | +// char apl_mode; |
| 84 | // char scripted; | 84 | // char scripted; |
| 85 | - char numeric_lock; | ||
| 86 | - char secure; | ||
| 87 | - char oerr_lock; | ||
| 88 | - char typeahead; | 85 | +// char numeric_lock; |
| 86 | +// char secure; | ||
| 87 | +// char oerr_lock; | ||
| 88 | +// char typeahead; | ||
| 89 | char debug_tracing; | 89 | char debug_tracing; |
| 90 | char disconnect_clear; | 90 | char disconnect_clear; |
| 91 | char highlight_bold; | 91 | char highlight_bold; |
| 92 | - char color8; | ||
| 93 | - char bsd_tm; | ||
| 94 | - char unlock_delay; | ||
| 95 | -#if defined(X3270_SCRIPT) /*[*/ | ||
| 96 | - char socket; | ||
| 97 | -#endif /*]*/ | ||
| 98 | -#if defined(C3270) && defined(_WIN32) /*[*/ | ||
| 99 | - char highlight_underline; | ||
| 100 | -#endif /*]*/ | 92 | +// char color8; |
| 93 | +// char bsd_tm; | ||
| 94 | +// char unlock_delay; | ||
| 95 | +// #if defined(X3270_SCRIPT) /*[*/ | ||
| 96 | +// char socket; | ||
| 97 | +// #endif /*]*/ | ||
| 98 | +// #if defined(C3270) && defined(_WIN32) /*[*/ | ||
| 99 | +// char highlight_underline; | ||
| 100 | +//#endif /*]*/ | ||
| 101 | 101 | ||
| 102 | /* Named resources */ | 102 | /* Named resources */ |
| 103 | /* | 103 | /* |
| @@ -108,7 +108,7 @@ typedef struct { | @@ -108,7 +108,7 @@ typedef struct { | ||
| 108 | #if defined(X3270_DISPLAY) || defined(C3270) | 108 | #if defined(X3270_DISPLAY) || defined(C3270) |
| 109 | // char *key_map; | 109 | // char *key_map; |
| 110 | char *compose_map; | 110 | char *compose_map; |
| 111 | - char *printer_lu; | 111 | +// char *printer_lu; |
| 112 | #endif | 112 | #endif |
| 113 | /* | 113 | /* |
| 114 | #if defined(X3270_DISPLAY) | 114 | #if defined(X3270_DISPLAY) |
| @@ -148,10 +148,10 @@ typedef struct { | @@ -148,10 +148,10 @@ typedef struct { | ||
| 148 | char *conf_dir; | 148 | char *conf_dir; |
| 149 | char *model; | 149 | char *model; |
| 150 | // char *hostsfile; | 150 | // char *hostsfile; |
| 151 | - char *port; | 151 | +// char *port; |
| 152 | char *charset; | 152 | char *charset; |
| 153 | - char *termname; | ||
| 154 | - char *login_macro; | 153 | +// char *termname; |
| 154 | +// char *login_macro; | ||
| 155 | char *macros; | 155 | char *macros; |
| 156 | #if defined(X3270_TRACE) /*[*/ | 156 | #if defined(X3270_TRACE) /*[*/ |
| 157 | #if !defined(_WIN32) /*[*/ | 157 | #if !defined(_WIN32) /*[*/ |
| @@ -186,7 +186,7 @@ typedef struct { | @@ -186,7 +186,7 @@ typedef struct { | ||
| 186 | #if defined(HAVE_LIBSSL) /*[*/ | 186 | #if defined(HAVE_LIBSSL) /*[*/ |
| 187 | char *cert_file; | 187 | char *cert_file; |
| 188 | #endif /*]*/ | 188 | #endif /*]*/ |
| 189 | - char *proxy; | 189 | +// char *proxy; |
| 190 | 190 | ||
| 191 | /* Toggles */ | 191 | /* Toggles */ |
| 192 | // struct toggle toggle[N_TOGGLES]; | 192 | // struct toggle toggle[N_TOGGLES]; |
| @@ -198,8 +198,10 @@ typedef struct { | @@ -198,8 +198,10 @@ typedef struct { | ||
| 198 | Cursor locked_mcursor; | 198 | Cursor locked_mcursor; |
| 199 | #endif | 199 | #endif |
| 200 | */ | 200 | */ |
| 201 | -#if defined(X3270_ANSI) /*[*/ | ||
| 202 | - /* Line-mode TTY parameters */ | 201 | + |
| 202 | +/* | ||
| 203 | +#if defined(X3270_ANSI) | ||
| 204 | + // Line-mode TTY parameters | ||
| 203 | char icrnl; | 205 | char icrnl; |
| 204 | char inlcr; | 206 | char inlcr; |
| 205 | char onlcr; | 207 | char onlcr; |
| @@ -211,11 +213,12 @@ typedef struct { | @@ -211,11 +213,12 @@ typedef struct { | ||
| 211 | char *intr; | 213 | char *intr; |
| 212 | char *quit; | 214 | char *quit; |
| 213 | char *eof; | 215 | char *eof; |
| 214 | -#endif /*]*/ | ||
| 215 | - | ||
| 216 | -#if defined(WC3270) /*[*/ | ||
| 217 | - char *hostname; | ||
| 218 | #endif | 216 | #endif |
| 217 | +*/ | ||
| 218 | + | ||
| 219 | +// #if defined(WC3270) /*[*/ | ||
| 220 | +// char *hostname; | ||
| 221 | +// #endif | ||
| 219 | 222 | ||
| 220 | /* | 223 | /* |
| 221 | #if defined(WC3270) | 224 | #if defined(WC3270) |
ctlr.c
| @@ -150,8 +150,8 @@ void ctlr_init(H3270 *session, unsigned cmask unused) | @@ -150,8 +150,8 @@ void ctlr_init(H3270 *session, unsigned cmask unused) | ||
| 150 | { | 150 | { |
| 151 | /* Register callback routines. */ | 151 | /* Register callback routines. */ |
| 152 | lib3270_register_schange(session,ST_HALF_CONNECT, ctlr_half_connect, 0); | 152 | lib3270_register_schange(session,ST_HALF_CONNECT, ctlr_half_connect, 0); |
| 153 | - lib3270_register_schange(session,ST_CONNECT, ctlr_connect, 0); | ||
| 154 | - lib3270_register_schange(session,ST_3270_MODE, ctlr_connect, 0); | 153 | + lib3270_register_schange(session,LIB3270_STATE_CONNECT, ctlr_connect, 0); |
| 154 | + lib3270_register_schange(session,LIB3270_STATE_3270_MODE, ctlr_connect, 0); | ||
| 155 | } | 155 | } |
| 156 | /* | 156 | /* |
| 157 | * Reinitialize the emulated 3270 hardware. | 157 | * Reinitialize the emulated 3270 hardware. |
| @@ -2320,7 +2320,7 @@ ctlr_clear(H3270 *session, Boolean can_snap) | @@ -2320,7 +2320,7 @@ ctlr_clear(H3270 *session, Boolean can_snap) | ||
| 2320 | /* Snap any data that is about to be lost into the trace file. */ | 2320 | /* Snap any data that is about to be lost into the trace file. */ |
| 2321 | if (ctlr_any_data()) { | 2321 | if (ctlr_any_data()) { |
| 2322 | #if defined(X3270_TRACE) /*[*/ | 2322 | #if defined(X3270_TRACE) /*[*/ |
| 2323 | - if (can_snap && !trace_skipping && toggled(SCREEN_TRACE)) | 2323 | + if (can_snap && !trace_skipping && lib3270_get_toggle(session,SCREEN_TRACE)) |
| 2324 | trace_screen(); | 2324 | trace_screen(); |
| 2325 | #endif /*]*/ | 2325 | #endif /*]*/ |
| 2326 | // scroll_save(session->maxROWS, ever_3270 ? False : True); | 2326 | // scroll_save(session->maxROWS, ever_3270 ? False : True); |
| @@ -2379,7 +2379,7 @@ void ctlr_add(int baddr, unsigned char c, unsigned char cs) | @@ -2379,7 +2379,7 @@ void ctlr_add(int baddr, unsigned char c, unsigned char cs) | ||
| 2379 | if (trace_primed && !IsBlank(oc)) | 2379 | if (trace_primed && !IsBlank(oc)) |
| 2380 | { | 2380 | { |
| 2381 | #if defined(X3270_TRACE) /*[*/ | 2381 | #if defined(X3270_TRACE) /*[*/ |
| 2382 | - if (toggled(SCREEN_TRACE)) | 2382 | + if (lib3270_get_toggle(&h3270,SCREEN_TRACE)) |
| 2383 | trace_screen(); | 2383 | trace_screen(); |
| 2384 | #endif /*]*/ | 2384 | #endif /*]*/ |
| 2385 | trace_primed = False; | 2385 | trace_primed = False; |
| @@ -2739,7 +2739,7 @@ void ticking_start(H3270 *session, Boolean anyway) | @@ -2739,7 +2739,7 @@ void ticking_start(H3270 *session, Boolean anyway) | ||
| 2739 | 2739 | ||
| 2740 | if(session->set_timer) | 2740 | if(session->set_timer) |
| 2741 | { | 2741 | { |
| 2742 | - if(toggled(SHOW_TIMING) || anyway) | 2742 | + if(lib3270_get_toggle(&h3270,SHOW_TIMING) || anyway) |
| 2743 | session->set_timer(session,1); | 2743 | session->set_timer(session,1); |
| 2744 | } | 2744 | } |
| 2745 | else | 2745 | else |
| @@ -2748,7 +2748,7 @@ void ticking_start(H3270 *session, Boolean anyway) | @@ -2748,7 +2748,7 @@ void ticking_start(H3270 *session, Boolean anyway) | ||
| 2748 | 2748 | ||
| 2749 | mticking = True; | 2749 | mticking = True; |
| 2750 | 2750 | ||
| 2751 | - if (!toggled(SHOW_TIMING) && !anyway) | 2751 | + if (!lib3270_get_toggle(&h3270,SHOW_TIMING) && !anyway) |
| 2752 | return; | 2752 | return; |
| 2753 | 2753 | ||
| 2754 | status_untiming(session); | 2754 | status_untiming(session); |
| @@ -114,8 +114,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | @@ -114,8 +114,8 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); | ||
| 114 | void ft_init(H3270 *session) | 114 | void ft_init(H3270 *session) |
| 115 | { | 115 | { |
| 116 | /* Register for state changes. */ | 116 | /* Register for state changes. */ |
| 117 | - lib3270_register_schange(session, ST_CONNECT, ( void (*)(H3270 *, int, void *)) ft_connected, NULL); | ||
| 118 | - lib3270_register_schange(session, ST_3270_MODE, ( void (*)(H3270 *, int, void *)) ft_in3270, NULL); | 117 | + lib3270_register_schange(session, LIB3270_STATE_CONNECT, ( void (*)(H3270 *, int, void *)) ft_connected, NULL); |
| 118 | + lib3270_register_schange(session, LIB3270_STATE_3270_MODE, ( void (*)(H3270 *, int, void *)) ft_in3270, NULL); | ||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | // enum ft_state QueryFTstate(void) | 121 | // enum ft_state QueryFTstate(void) |
globals.h
| @@ -307,22 +307,6 @@ LIB3270_INTERNAL struct trans_list *trans_list; | @@ -307,22 +307,6 @@ LIB3270_INTERNAL struct trans_list *trans_list; | ||
| 307 | /* input key type */ | 307 | /* input key type */ |
| 308 | // enum keytype { KT_STD, KT_GE }; | 308 | // enum keytype { KT_STD, KT_GE }; |
| 309 | 309 | ||
| 310 | -/* state changes */ /* | ||
| 311 | -enum state_change | ||
| 312 | -{ | ||
| 313 | - ST_RESOLVING, | ||
| 314 | - ST_HALF_CONNECT, | ||
| 315 | - ST_CONNECT, | ||
| 316 | - ST_3270_MODE, | ||
| 317 | - ST_LINE_MODE, | ||
| 318 | - ST_REMODEL, | ||
| 319 | - ST_PRINTER, | ||
| 320 | - ST_EXITING, | ||
| 321 | - ST_CHARSET, | ||
| 322 | - | ||
| 323 | - N_ST // Always the last one | ||
| 324 | -}; */ | ||
| 325 | - | ||
| 326 | /* Naming convention for private actions. */ | 310 | /* Naming convention for private actions. */ |
| 327 | #define PA_PFX "PA-" | 311 | #define PA_PFX "PA-" |
| 328 | 312 |
glue.c
| @@ -141,7 +141,7 @@ static void initialize(void) | @@ -141,7 +141,7 @@ static void initialize(void) | ||
| 141 | #endif /*]*/ | 141 | #endif /*]*/ |
| 142 | 142 | ||
| 143 | // appres.modified_sel = False; | 143 | // appres.modified_sel = False; |
| 144 | - appres.apl_mode = False; | 144 | +// appres.apl_mode = False; |
| 145 | 145 | ||
| 146 | /* | 146 | /* |
| 147 | #if defined(C3270) || defined(TCL3270) | 147 | #if defined(C3270) || defined(TCL3270) |
| @@ -151,16 +151,16 @@ static void initialize(void) | @@ -151,16 +151,16 @@ static void initialize(void) | ||
| 151 | #endif | 151 | #endif |
| 152 | */ | 152 | */ |
| 153 | 153 | ||
| 154 | - appres.numeric_lock = False; | 154 | +// appres.numeric_lock = False; |
| 155 | // appres.secure = False; | 155 | // appres.secure = False; |
| 156 | 156 | ||
| 157 | #if defined(C3270) /*[*/ | 157 | #if defined(C3270) /*[*/ |
| 158 | - appres.oerr_lock = True; | 158 | +// appres.oerr_lock = True; |
| 159 | #else /*][*/ | 159 | #else /*][*/ |
| 160 | - appres.oerr_lock = False; | 160 | +// appres.oerr_lock = False; |
| 161 | #endif /*]*/ | 161 | #endif /*]*/ |
| 162 | 162 | ||
| 163 | - appres.typeahead = True; | 163 | +// appres.typeahead = True; |
| 164 | appres.debug_tracing = True; | 164 | appres.debug_tracing = True; |
| 165 | 165 | ||
| 166 | #if defined(C3270) /*[*/ | 166 | #if defined(C3270) /*[*/ |
| @@ -169,7 +169,7 @@ static void initialize(void) | @@ -169,7 +169,7 @@ static void initialize(void) | ||
| 169 | 169 | ||
| 170 | appres.model = ""; | 170 | appres.model = ""; |
| 171 | // appres.hostsfile = CN; | 171 | // appres.hostsfile = CN; |
| 172 | - appres.port = "telnet"; | 172 | +// appres.port = "telnet"; |
| 173 | 173 | ||
| 174 | #if !defined(_WIN32) /*[*/ | 174 | #if !defined(_WIN32) /*[*/ |
| 175 | appres.charset = "bracket"; | 175 | appres.charset = "bracket"; |
| @@ -181,7 +181,7 @@ static void initialize(void) | @@ -181,7 +181,7 @@ static void initialize(void) | ||
| 181 | appres.charset = "bracket437"; | 181 | appres.charset = "bracket437"; |
| 182 | #endif /*]*/ | 182 | #endif /*]*/ |
| 183 | 183 | ||
| 184 | - appres.termname = CN; | 184 | +// appres.termname = CN; |
| 185 | appres.macros = CN; | 185 | appres.macros = CN; |
| 186 | 186 | ||
| 187 | #if defined(X3270_TRACE) /*[*/ | 187 | #if defined(X3270_TRACE) /*[*/ |
| @@ -206,21 +206,21 @@ static void initialize(void) | @@ -206,21 +206,21 @@ static void initialize(void) | ||
| 206 | // appres.cbreak_mode = False; | 206 | // appres.cbreak_mode = False; |
| 207 | #endif /*]*/ | 207 | #endif /*]*/ |
| 208 | 208 | ||
| 209 | -#if defined(X3270_ANSI) /*[*/ | ||
| 210 | - appres.icrnl = True; | ||
| 211 | - appres.inlcr = False; | ||
| 212 | - appres.onlcr = True; | ||
| 213 | - appres.erase = "^H"; | ||
| 214 | - appres.kill = "^U"; | ||
| 215 | - appres.werase = "^W"; | ||
| 216 | - appres.rprnt = "^R"; | ||
| 217 | - appres.lnext = "^V"; | ||
| 218 | - appres.intr = "^C"; | ||
| 219 | - appres.quit = "^\\"; | ||
| 220 | - appres.eof = "^D"; | 209 | +#if defined(X3270_ANSI) |
| 210 | +// appres.icrnl = True; | ||
| 211 | +// appres.inlcr = False; | ||
| 212 | +// appres.onlcr = True; | ||
| 213 | +// appres.erase = "^H"; | ||
| 214 | +// appres.kill = "^U"; | ||
| 215 | +// appres.werase = "^W"; | ||
| 216 | +// appres.rprnt = "^R"; | ||
| 217 | +// appres.lnext = "^V"; | ||
| 218 | +// appres.intr = "^C"; | ||
| 219 | +// appres.quit = "^\\"; | ||
| 220 | +// appres.eof = "^D"; | ||
| 221 | #endif /*]*/ | 221 | #endif /*]*/ |
| 222 | 222 | ||
| 223 | - appres.unlock_delay = True; | 223 | +// appres.unlock_delay = True; |
| 224 | 224 | ||
| 225 | #if defined(X3270_FT) /*[*/ | 225 | #if defined(X3270_FT) /*[*/ |
| 226 | appres.dft_buffer_size = DFT_BUF; | 226 | appres.dft_buffer_size = DFT_BUF; |
| @@ -296,7 +296,7 @@ static const struct lib3270_option options[] = | @@ -296,7 +296,7 @@ static const struct lib3270_option options[] = | ||
| 296 | // { OptAllBold, OPT_BOOLEAN, True, ResAllBold, offset(all_bold_on), NULL }, | 296 | // { OptAllBold, OPT_BOOLEAN, True, ResAllBold, offset(all_bold_on), NULL }, |
| 297 | // { OptAltScreen,OPT_STRING, False, ResAltScreen, offset(altscreen), NULL }, | 297 | // { OptAltScreen,OPT_STRING, False, ResAltScreen, offset(altscreen), NULL }, |
| 298 | //#endif /*]*/ | 298 | //#endif /*]*/ |
| 299 | - { OptAplMode, OPT_BOOLEAN, True, ResAplMode, offset(apl_mode), NULL }, | 299 | +// { OptAplMode, OPT_BOOLEAN, True, ResAplMode, offset(apl_mode), NULL }, |
| 300 | #if defined(C3270) /*[*/ | 300 | #if defined(C3270) /*[*/ |
| 301 | // { OptCbreak, OPT_BOOLEAN, True, ResCbreak, offset(cbreak_mode), NULL }, | 301 | // { OptCbreak, OPT_BOOLEAN, True, ResCbreak, offset(cbreak_mode), NULL }, |
| 302 | #endif /*]*/ | 302 | #endif /*]*/ |
| @@ -323,11 +323,11 @@ static const struct lib3270_option options[] = | @@ -323,11 +323,11 @@ static const struct lib3270_option options[] = | ||
| 323 | // #endif /*]*/ | 323 | // #endif /*]*/ |
| 324 | // { OptOnce, OPT_BOOLEAN, True, ResOnce, offset(once), NULL }, | 324 | // { OptOnce, OPT_BOOLEAN, True, ResOnce, offset(once), NULL }, |
| 325 | // { OptOversize, OPT_STRING, False, ResOversize, offset(oversize), N_( "Sets the screen dimensions to be larger than the default for the chosen model (COLSxROWS)." ) }, | 325 | // { OptOversize, OPT_STRING, False, ResOversize, offset(oversize), N_( "Sets the screen dimensions to be larger than the default for the chosen model (COLSxROWS)." ) }, |
| 326 | - { OptPort, OPT_STRING, False, ResPort, offset(port), N_( "The name of the default TCP port to connect" ) }, | 326 | +// { OptPort, OPT_STRING, False, ResPort, offset(port), N_( "The name of the default TCP port to connect" ) }, |
| 327 | #if defined(C3270) && !defined(LIB3270) /*[*/ | 327 | #if defined(C3270) && !defined(LIB3270) /*[*/ |
| 328 | - { OptPrinterLu,OPT_STRING, False, ResPrinterLu, offset(printer_lu), NULL }, | 328 | +// { OptPrinterLu,OPT_STRING, False, ResPrinterLu, offset(printer_lu), NULL }, |
| 329 | #endif /*]*/ | 329 | #endif /*]*/ |
| 330 | - { OptProxy, OPT_STRING, False, ResProxy, offset(proxy), N_( "Proxy server (type:host[:port])" ) }, | 330 | +// { OptProxy, OPT_STRING, False, ResProxy, offset(proxy), N_( "Proxy server (type:host[:port])" ) }, |
| 331 | #if defined(S3270) /*[*/ | 331 | #if defined(S3270) /*[*/ |
| 332 | { OptScripted, OPT_NOP, False, ResScripted, NULL, NULL }, | 332 | { OptScripted, OPT_NOP, False, ResScripted, NULL, NULL }, |
| 333 | #endif /*]*/ | 333 | #endif /*]*/ |
| @@ -339,7 +339,7 @@ static const struct lib3270_option options[] = | @@ -339,7 +339,7 @@ static const struct lib3270_option options[] = | ||
| 339 | { OptSocket, OPT_BOOLEAN, True, ResSocket, offset(socket), NULL }, | 339 | { OptSocket, OPT_BOOLEAN, True, ResSocket, offset(socket), NULL }, |
| 340 | #endif /*]*/ | 340 | #endif /*]*/ |
| 341 | 341 | ||
| 342 | - { OptTermName, OPT_STRING, False, ResTermName, offset(termname), N_( "Specifies the terminal name to be transmitted over the telnet connection." ) }, | 342 | +// { OptTermName, OPT_STRING, False, ResTermName, offset(termname), N_( "Specifies the terminal name to be transmitted over the telnet connection." ) }, |
| 343 | 343 | ||
| 344 | #if defined(WC3270) /*[*/ | 344 | #if defined(WC3270) /*[*/ |
| 345 | { OptTitle, OPT_STRING, False, ResTitle, offset(title), NULL }, | 345 | { OptTitle, OPT_STRING, False, ResTitle, offset(title), NULL }, |
| @@ -377,17 +377,17 @@ static struct { | @@ -377,17 +377,17 @@ static struct { | ||
| 377 | } resources[] = { | 377 | } resources[] = { |
| 378 | { ResAllBold, offset(all_bold), XRM_STRING }, | 378 | { ResAllBold, offset(all_bold), XRM_STRING }, |
| 379 | // { ResAltScreen, offset(altscreen), XRM_STRING }, | 379 | // { ResAltScreen, offset(altscreen), XRM_STRING }, |
| 380 | - { ResBsdTm, offset(bsd_tm), XRM_BOOLEAN }, | 380 | +// { ResBsdTm, offset(bsd_tm), XRM_BOOLEAN }, |
| 381 | #if defined(HAVE_LIBSSL) /*[*/ | 381 | #if defined(HAVE_LIBSSL) /*[*/ |
| 382 | { ResCertFile, offset(cert_file), XRM_STRING }, | 382 | { ResCertFile, offset(cert_file), XRM_STRING }, |
| 383 | #endif /*]*/ | 383 | #endif /*]*/ |
| 384 | { ResCharset, offset(charset), XRM_STRING }, | 384 | { ResCharset, offset(charset), XRM_STRING }, |
| 385 | - { ResColor8, offset(color8), XRM_BOOLEAN }, | 385 | +// { ResColor8, offset(color8), XRM_BOOLEAN }, |
| 386 | { ResConfDir, offset(conf_dir), XRM_STRING }, | 386 | { ResConfDir, offset(conf_dir), XRM_STRING }, |
| 387 | // { ResDefScreen, offset(defscreen), XRM_STRING }, | 387 | // { ResDefScreen, offset(defscreen), XRM_STRING }, |
| 388 | #if defined(X3270_ANSI) /*[*/ | 388 | #if defined(X3270_ANSI) /*[*/ |
| 389 | - { ResEof, offset(eof), XRM_STRING }, | ||
| 390 | - { ResErase, offset(erase), XRM_STRING }, | 389 | +// { ResEof, offset(eof), XRM_STRING }, |
| 390 | +// { ResErase, offset(erase), XRM_STRING }, | ||
| 391 | #endif /*]*/ | 391 | #endif /*]*/ |
| 392 | // { ResExtended, offset(extended), XRM_BOOLEAN }, | 392 | // { ResExtended, offset(extended), XRM_BOOLEAN }, |
| 393 | #if defined(X3270_FT) /*[*/ | 393 | #if defined(X3270_FT) /*[*/ |
| @@ -399,10 +399,10 @@ static struct { | @@ -399,10 +399,10 @@ static struct { | ||
| 399 | #endif /*]*/ | 399 | #endif /*]*/ |
| 400 | // { ResHostsFile, offset(hostsfile), XRM_STRING }, | 400 | // { ResHostsFile, offset(hostsfile), XRM_STRING }, |
| 401 | #if defined(X3270_ANSI) /*[*/ | 401 | #if defined(X3270_ANSI) /*[*/ |
| 402 | - { ResIcrnl, offset(icrnl), XRM_BOOLEAN }, | ||
| 403 | - { ResInlcr, offset(inlcr), XRM_BOOLEAN }, | ||
| 404 | - { ResOnlcr, offset(onlcr), XRM_BOOLEAN }, | ||
| 405 | - { ResIntr, offset(intr), XRM_STRING }, | 402 | +// { ResIcrnl, offset(icrnl), XRM_BOOLEAN }, |
| 403 | +// { ResInlcr, offset(inlcr), XRM_BOOLEAN }, | ||
| 404 | +// { ResOnlcr, offset(onlcr), XRM_BOOLEAN }, | ||
| 405 | +// { ResIntr, offset(intr), XRM_STRING }, | ||
| 406 | #endif /*]*/ | 406 | #endif /*]*/ |
| 407 | #if defined(X3270_SCRIPT) /*[*/ | 407 | #if defined(X3270_SCRIPT) /*[*/ |
| 408 | { ResPluginCommand, offset(plugin_command), XRM_STRING }, | 408 | { ResPluginCommand, offset(plugin_command), XRM_STRING }, |
| @@ -422,31 +422,31 @@ static struct { | @@ -422,31 +422,31 @@ static struct { | ||
| 422 | // { ResCbreak, offset(cbreak_mode), XRM_BOOLEAN }, | 422 | // { ResCbreak, offset(cbreak_mode), XRM_BOOLEAN }, |
| 423 | #endif /*]*/ | 423 | #endif /*]*/ |
| 424 | #if defined(X3270_ANSI) /*[*/ | 424 | #if defined(X3270_ANSI) /*[*/ |
| 425 | - { ResKill, offset(kill), XRM_STRING }, | ||
| 426 | - { ResLnext, offset(lnext), XRM_STRING }, | 425 | +// { ResKill, offset(kill), XRM_STRING }, |
| 426 | +// { ResLnext, offset(lnext), XRM_STRING }, | ||
| 427 | #endif /*]*/ | 427 | #endif /*]*/ |
| 428 | - { ResLoginMacro,offset(login_macro), XRM_STRING }, | 428 | +// { ResLoginMacro,offset(login_macro), XRM_STRING }, |
| 429 | // { ResM3279, offset(m3279), XRM_BOOLEAN }, | 429 | // { ResM3279, offset(m3279), XRM_BOOLEAN }, |
| 430 | // { ResModel, offset(model), XRM_STRING }, | 430 | // { ResModel, offset(model), XRM_STRING }, |
| 431 | // { ResModifiedSel, offset(modified_sel), XRM_BOOLEAN }, | 431 | // { ResModifiedSel, offset(modified_sel), XRM_BOOLEAN }, |
| 432 | //#if defined(C3270) && !defined(_WIN32) /*[*/ | 432 | //#if defined(C3270) && !defined(_WIN32) /*[*/ |
| 433 | // { ResMono, offset(mono), XRM_BOOLEAN }, | 433 | // { ResMono, offset(mono), XRM_BOOLEAN }, |
| 434 | //#endif /*]*/ | 434 | //#endif /*]*/ |
| 435 | - { ResNumericLock, offset(numeric_lock), XRM_BOOLEAN }, | ||
| 436 | - { ResOerrLock, offset(oerr_lock), XRM_BOOLEAN }, | 435 | +// { ResNumericLock, offset(numeric_lock), XRM_BOOLEAN }, |
| 436 | +// { ResOerrLock, offset(oerr_lock), XRM_BOOLEAN }, | ||
| 437 | // { ResOversize, offset(oversize), XRM_STRING }, | 437 | // { ResOversize, offset(oversize), XRM_STRING }, |
| 438 | - { ResPort, offset(port), XRM_STRING }, | 438 | +// { ResPort, offset(port), XRM_STRING }, |
| 439 | #if defined(C3270) /*[*/ | 439 | #if defined(C3270) /*[*/ |
| 440 | - { ResPrinterLu, offset(printer_lu), XRM_STRING }, | 440 | +// { ResPrinterLu, offset(printer_lu), XRM_STRING }, |
| 441 | { ResPrintTextCommand, NULL, XRM_STRING }, | 441 | { ResPrintTextCommand, NULL, XRM_STRING }, |
| 442 | #endif /*]*/ | 442 | #endif /*]*/ |
| 443 | - { ResProxy, offset(proxy), XRM_STRING }, | 443 | +// { ResProxy, offset(proxy), XRM_STRING }, |
| 444 | #if defined(X3270_ANSI) /*[*/ | 444 | #if defined(X3270_ANSI) /*[*/ |
| 445 | - { ResQuit, offset(quit), XRM_STRING }, | ||
| 446 | - { ResRprnt, offset(rprnt), XRM_STRING }, | 445 | +// { ResQuit, offset(quit), XRM_STRING }, |
| 446 | +// { ResRprnt, offset(rprnt), XRM_STRING }, | ||
| 447 | #endif /*]*/ | 447 | #endif /*]*/ |
| 448 | // { ResSecure, offset(secure), XRM_BOOLEAN }, | 448 | // { ResSecure, offset(secure), XRM_BOOLEAN }, |
| 449 | - { ResTermName, offset(termname), XRM_STRING }, | 449 | +// { ResTermName, offset(termname), XRM_STRING }, |
| 450 | #if defined(WC3270) /*[*/ | 450 | #if defined(WC3270) /*[*/ |
| 451 | { ResTitle, offset(title), XRM_STRING }, | 451 | { ResTitle, offset(title), XRM_STRING }, |
| 452 | #endif /*]*/ | 452 | #endif /*]*/ |
| @@ -460,10 +460,10 @@ static struct { | @@ -460,10 +460,10 @@ static struct { | ||
| 460 | { ResTraceMonitor,offset(trace_monitor),XRM_BOOLEAN }, | 460 | { ResTraceMonitor,offset(trace_monitor),XRM_BOOLEAN }, |
| 461 | #endif /*]*/ | 461 | #endif /*]*/ |
| 462 | #endif /*]*/ | 462 | #endif /*]*/ |
| 463 | - { ResTypeahead, offset(typeahead), XRM_BOOLEAN }, | ||
| 464 | - { ResUnlockDelay,offset(unlock_delay), XRM_BOOLEAN }, | 463 | +// { ResTypeahead, offset(typeahead), XRM_BOOLEAN }, |
| 464 | +// { ResUnlockDelay,offset(unlock_delay), XRM_BOOLEAN }, | ||
| 465 | #if defined(X3270_ANSI) /*[*/ | 465 | #if defined(X3270_ANSI) /*[*/ |
| 466 | - { ResWerase, offset(werase), XRM_STRING }, | 466 | +// { ResWerase, offset(werase), XRM_STRING }, |
| 467 | #endif /*]*/ | 467 | #endif /*]*/ |
| 468 | 468 | ||
| 469 | { CN, 0, XRM_STRING } | 469 | { CN, 0, XRM_STRING } |
host.c
| @@ -39,7 +39,7 @@ | @@ -39,7 +39,7 @@ | ||
| 39 | */ | 39 | */ |
| 40 | 40 | ||
| 41 | #include "globals.h" | 41 | #include "globals.h" |
| 42 | -#include "appres.h" | 42 | +// #include "appres.h" |
| 43 | #include "resources.h" | 43 | #include "resources.h" |
| 44 | 44 | ||
| 45 | #include "actionsc.h" | 45 | #include "actionsc.h" |
| @@ -477,7 +477,7 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -477,7 +477,7 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 477 | char nb[2048]; /* name buffer */ | 477 | char nb[2048]; /* name buffer */ |
| 478 | char *s; /* temporary */ | 478 | char *s; /* temporary */ |
| 479 | const char *chost; /* to whom we will connect */ | 479 | const char *chost; /* to whom we will connect */ |
| 480 | - char *ps = CN; | 480 | +// char *ps = CN; |
| 481 | char *port = CN; | 481 | char *port = CN; |
| 482 | Boolean resolving; | 482 | Boolean resolving; |
| 483 | Boolean pending; | 483 | Boolean pending; |
| @@ -522,7 +522,7 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -522,7 +522,7 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 522 | 522 | ||
| 523 | /* Default the port. */ | 523 | /* Default the port. */ |
| 524 | if (port == CN) | 524 | if (port == CN) |
| 525 | - port = appres.port; | 525 | + port = "telnet"; |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | /* | 528 | /* |
| @@ -566,8 +566,8 @@ static int do_connect(H3270 *hSession, const char *n) | @@ -566,8 +566,8 @@ static int do_connect(H3270 *hSession, const char *n) | ||
| 566 | /* Success. */ | 566 | /* Success. */ |
| 567 | 567 | ||
| 568 | /* Set pending string. */ | 568 | /* Set pending string. */ |
| 569 | - if (ps == CN) | ||
| 570 | - ps = appres.login_macro; | 569 | +// if (ps == CN) |
| 570 | +// ps = appres.login_macro; | ||
| 571 | 571 | ||
| 572 | // if (ps != CN) | 572 | // if (ps != CN) |
| 573 | // login_macro(ps); | 573 | // login_macro(ps); |
| @@ -656,7 +656,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | @@ -656,7 +656,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait) | ||
| 656 | static void try_reconnect(H3270 *session) | 656 | static void try_reconnect(H3270 *session) |
| 657 | { | 657 | { |
| 658 | lib3270_write_log(session,"3270","Starting auto-reconnect (Host: %s)",session->full_current_host ? session->full_current_host : "-"); | 658 | lib3270_write_log(session,"3270","Starting auto-reconnect (Host: %s)",session->full_current_host ? session->full_current_host : "-"); |
| 659 | - session->auto_reconnect_inprogress = False; | 659 | + session->auto_reconnect_inprogress = 0; |
| 660 | lib3270_reconnect(session,0); | 660 | lib3270_reconnect(session,0); |
| 661 | } | 661 | } |
| 662 | 662 | ||
| @@ -686,11 +686,11 @@ void host_disconnect(H3270 *h, int failed) | @@ -686,11 +686,11 @@ void host_disconnect(H3270 *h, int failed) | ||
| 686 | 686 | ||
| 687 | net_disconnect(h); | 687 | net_disconnect(h); |
| 688 | 688 | ||
| 689 | - Trace("Disconnected (Failed: %d Reconnect: %d in_progress: %d)",failed,toggled(RECONNECT),h->auto_reconnect_inprogress); | ||
| 690 | - if (toggled(RECONNECT) && !h->auto_reconnect_inprogress) | 689 | + trace("Disconnected (Failed: %d Reconnect: %d in_progress: %d)",failed,lib3270_get_toggle(h,LIB3270_TOGGLE_RECONNECT),h->auto_reconnect_inprogress); |
| 690 | + if (lib3270_get_toggle(h,LIB3270_TOGGLE_RECONNECT) && !h->auto_reconnect_inprogress) | ||
| 691 | { | 691 | { |
| 692 | /* Schedule an automatic reconnection. */ | 692 | /* Schedule an automatic reconnection. */ |
| 693 | - h->auto_reconnect_inprogress = True; | 693 | + h->auto_reconnect_inprogress = 1; |
| 694 | (void) AddTimeOut(failed ? RECONNECT_ERR_MS: RECONNECT_MS, h, try_reconnect); | 694 | (void) AddTimeOut(failed ? RECONNECT_ERR_MS: RECONNECT_MS, h, try_reconnect); |
| 695 | } | 695 | } |
| 696 | 696 | ||
| @@ -699,7 +699,7 @@ void host_disconnect(H3270 *h, int failed) | @@ -699,7 +699,7 @@ void host_disconnect(H3270 *h, int failed) | ||
| 699 | * in sync. | 699 | * in sync. |
| 700 | */ | 700 | */ |
| 701 | #if defined(X3270_TRACE) /*[*/ | 701 | #if defined(X3270_TRACE) /*[*/ |
| 702 | - if (IN_ANSI && toggled(SCREEN_TRACE)) | 702 | + if (IN_ANSI && lib3270_get_toggle(h,LIB3270_TOGGLE_SCREEN_TRACE)) |
| 703 | trace_ansi_disc(); | 703 | trace_ansi_disc(); |
| 704 | #endif /*]*/ | 704 | #endif /*]*/ |
| 705 | 705 | ||
| @@ -716,13 +716,13 @@ void host_in3270(H3270 *session, LIB3270_CSTATE new_cstate) | @@ -716,13 +716,13 @@ void host_in3270(H3270 *session, LIB3270_CSTATE new_cstate) | ||
| 716 | 716 | ||
| 717 | session->cstate = new_cstate; | 717 | session->cstate = new_cstate; |
| 718 | session->ever_3270 = now3270; | 718 | session->ever_3270 = now3270; |
| 719 | - lib3270_st_changed(session, ST_3270_MODE, now3270); | 719 | + lib3270_st_changed(session, LIB3270_STATE_3270_MODE, now3270); |
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | void host_connected(H3270 *session) | 722 | void host_connected(H3270 *session) |
| 723 | { | 723 | { |
| 724 | session->cstate = CONNECTED_INITIAL; | 724 | session->cstate = CONNECTED_INITIAL; |
| 725 | - lib3270_st_changed(session, ST_CONNECT, True); | 725 | + lib3270_st_changed(session, LIB3270_STATE_CONNECT, True); |
| 726 | if(session->update_connect) | 726 | if(session->update_connect) |
| 727 | session->update_connect(session,1); | 727 | session->update_connect(session,1); |
| 728 | } | 728 | } |
| @@ -731,7 +731,7 @@ void host_disconnected(H3270 *session) | @@ -731,7 +731,7 @@ void host_disconnected(H3270 *session) | ||
| 731 | { | 731 | { |
| 732 | session->cstate = NOT_CONNECTED; | 732 | session->cstate = NOT_CONNECTED; |
| 733 | set_status(session,OIA_FLAG_UNDERA,False); | 733 | set_status(session,OIA_FLAG_UNDERA,False); |
| 734 | - lib3270_st_changed(session,ST_CONNECT, False); | 734 | + lib3270_st_changed(session,LIB3270_STATE_CONNECT, False); |
| 735 | status_changed(session,LIB3270_MESSAGE_DISCONNECTED); | 735 | status_changed(session,LIB3270_MESSAGE_DISCONNECTED); |
| 736 | if(session->update_connect) | 736 | if(session->update_connect) |
| 737 | session->update_connect(session,0); | 737 | session->update_connect(session,0); |
| @@ -758,15 +758,35 @@ LIB3270_EXPORT void lib3270_register_schange(H3270 *h,LIB3270_STATE_CHANGE tx, v | @@ -758,15 +758,35 @@ LIB3270_EXPORT void lib3270_register_schange(H3270 *h,LIB3270_STATE_CHANGE tx, v | ||
| 758 | } | 758 | } |
| 759 | 759 | ||
| 760 | /* Signal a state change. */ | 760 | /* Signal a state change. */ |
| 761 | -void lib3270_st_changed(H3270 *h, int tx, int mode) | 761 | +void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode) |
| 762 | { | 762 | { |
| 763 | +#if defined(DEBUG) | ||
| 764 | + | ||
| 765 | + static const char * state_name[LIB3270_STATE_USER] = | ||
| 766 | + { | ||
| 767 | + "LIB3270_STATE_RESOLVING", | ||
| 768 | + "LIB3270_STATE_HALF_CONNECT", | ||
| 769 | + "LIB3270_STATE_CONNECT", | ||
| 770 | + "LIB3270_STATE_3270_MODE", | ||
| 771 | + "LIB3270_STATE_LINE_MODE", | ||
| 772 | + "LIB3270_STATE_REMODEL", | ||
| 773 | + "LIB3270_STATE_PRINTER", | ||
| 774 | + "LIB3270_STATE_EXITING", | ||
| 775 | + "LIB3270_STATE_CHARSET", | ||
| 776 | + | ||
| 777 | + }; | ||
| 778 | + | ||
| 779 | +#endif // DEBUG | ||
| 780 | + | ||
| 763 | struct lib3270_state_callback *st; | 781 | struct lib3270_state_callback *st; |
| 764 | 782 | ||
| 765 | CHECK_SESSION_HANDLE(h); | 783 | CHECK_SESSION_HANDLE(h); |
| 766 | 784 | ||
| 785 | + trace("%s is %d",state_name[tx],mode); | ||
| 786 | + | ||
| 767 | for (st = h->st_callbacks[tx];st != (struct lib3270_state_callback *)NULL;st = st->next) | 787 | for (st = h->st_callbacks[tx];st != (struct lib3270_state_callback *)NULL;st = st->next) |
| 768 | { | 788 | { |
| 769 | - (*st->func)(h,mode,st->data); | 789 | + st->func(h,mode,st->data); |
| 770 | } | 790 | } |
| 771 | } | 791 | } |
| 772 | 792 | ||
| @@ -817,7 +837,7 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *h,int wait) | @@ -817,7 +837,7 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *h,int wait) | ||
| 817 | 837 | ||
| 818 | if(rc) | 838 | if(rc) |
| 819 | { | 839 | { |
| 820 | - h->auto_reconnect_inprogress = False; | 840 | + h->auto_reconnect_inprogress = 0; |
| 821 | return rc; | 841 | return rc; |
| 822 | } | 842 | } |
| 823 | 843 |
hostc.h
| @@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
| 21 | 21 | ||
| 22 | #define st_changed(tx,mode) lib3270_st_changed(NULL,tx,mode) | 22 | #define st_changed(tx,mode) lib3270_st_changed(NULL,tx,mode) |
| 23 | 23 | ||
| 24 | - LIB3270_INTERNAL void lib3270_st_changed(H3270 *h, int tx, int mode); | 24 | + LIB3270_INTERNAL void lib3270_st_changed(H3270 *h, LIB3270_STATE tx, int mode); |
| 25 | LIB3270_INTERNAL void host_connected(H3270 *session); | 25 | LIB3270_INTERNAL void host_connected(H3270 *session); |
| 26 | LIB3270_INTERNAL void host_disconnected(H3270 *session); | 26 | LIB3270_INTERNAL void host_disconnected(H3270 *session); |
| 27 | LIB3270_INTERNAL void host_in3270(H3270 *session, LIB3270_CSTATE); | 27 | LIB3270_INTERNAL void host_in3270(H3270 *session, LIB3270_CSTATE); |
init.c
| @@ -134,7 +134,12 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -134,7 +134,12 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
| 134 | hSession->sz = sizeof(H3270); | 134 | hSession->sz = sizeof(H3270); |
| 135 | 135 | ||
| 136 | // Set the defaults. | 136 | // Set the defaults. |
| 137 | - hSession->extended = 1; | 137 | + hSession->extended = 1; |
| 138 | + hSession->typeahead = 1; | ||
| 139 | + hSession->oerr_lock = 1; | ||
| 140 | + hSession->unlock_delay = 1; | ||
| 141 | + hSession->icrnl = 1; | ||
| 142 | + hSession->onlcr = 1; | ||
| 138 | 143 | ||
| 139 | // Initialize toggles | 144 | // Initialize toggles |
| 140 | initialize_toggles(hSession); | 145 | initialize_toggles(hSession); |
| @@ -208,14 +213,14 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | @@ -208,14 +213,14 @@ static void lib3270_session_init(H3270 *hSession, const char *model) | ||
| 208 | } | 213 | } |
| 209 | ctlr_set_rows_cols(hSession, model_number, ovc, ovr); | 214 | ctlr_set_rows_cols(hSession, model_number, ovc, ovr); |
| 210 | 215 | ||
| 211 | - if (appres.termname != CN) | ||
| 212 | - hSession->termtype = appres.termname; | 216 | + if (hSession->termname != CN) |
| 217 | + hSession->termtype = hSession->termname; | ||
| 213 | else | 218 | else |
| 214 | hSession->termtype = hSession->full_model_name; | 219 | hSession->termtype = hSession->full_model_name; |
| 215 | 220 | ||
| 216 | Trace("Termtype: %s",hSession->termtype); | 221 | Trace("Termtype: %s",hSession->termtype); |
| 217 | 222 | ||
| 218 | - if (appres.apl_mode) | 223 | + if (hSession->apl_mode) |
| 219 | appres.charset = "apl"; | 224 | appres.charset = "apl"; |
| 220 | 225 | ||
| 221 | } | 226 | } |
kybd.c
| @@ -48,7 +48,7 @@ | @@ -48,7 +48,7 @@ | ||
| 48 | 48 | ||
| 49 | #include <fcntl.h> | 49 | #include <fcntl.h> |
| 50 | #include "3270ds.h" | 50 | #include "3270ds.h" |
| 51 | -#include "appres.h" | 51 | +// #include "appres.h" |
| 52 | // #include "ctlr.h" | 52 | // #include "ctlr.h" |
| 53 | #include "resources.h" | 53 | #include "resources.h" |
| 54 | 54 | ||
| @@ -195,7 +195,7 @@ static int enq_chk(void) | @@ -195,7 +195,7 @@ static int enq_chk(void) | ||
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | /* If typeahead disabled, complain and drop it. */ | 197 | /* If typeahead disabled, complain and drop it. */ |
| 198 | - if (!appres.typeahead) | 198 | + if (!h3270.typeahead) |
| 199 | { | 199 | { |
| 200 | trace_event(" dropped (no typeahead)\n"); | 200 | trace_event(" dropped (no typeahead)\n"); |
| 201 | return -1; | 201 | return -1; |
| @@ -439,8 +439,8 @@ kybd_in3270(H3270 *session, int in3270 unused, void *dunno) | @@ -439,8 +439,8 @@ kybd_in3270(H3270 *session, int in3270 unused, void *dunno) | ||
| 439 | void kybd_init(void) | 439 | void kybd_init(void) |
| 440 | { | 440 | { |
| 441 | /* Register interest in connect and disconnect events. */ | 441 | /* Register interest in connect and disconnect events. */ |
| 442 | - register_schange(ST_CONNECT, kybd_connect); | ||
| 443 | - register_schange(ST_3270_MODE, kybd_in3270); | 442 | + lib3270_register_schange(NULL,LIB3270_STATE_CONNECT,kybd_connect,NULL); |
| 443 | + lib3270_register_schange(NULL,LIB3270_STATE_3270_MODE,kybd_in3270,NULL); | ||
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | /* | 446 | /* |
| @@ -464,12 +464,15 @@ operator_error(int error_type) | @@ -464,12 +464,15 @@ operator_error(int error_type) | ||
| 464 | // if (sms_redirect()) | 464 | // if (sms_redirect()) |
| 465 | // popup_an_error("Keyboard locked"); | 465 | // popup_an_error("Keyboard locked"); |
| 466 | 466 | ||
| 467 | - if(appres.oerr_lock) { // || sms_redirect()) { | 467 | + if(h3270.oerr_lock) |
| 468 | + { | ||
| 468 | status_oerr(NULL,error_type); | 469 | status_oerr(NULL,error_type); |
| 469 | mcursor_locked(&h3270); | 470 | mcursor_locked(&h3270); |
| 470 | kybdlock_set((unsigned int)error_type, "operator_error"); | 471 | kybdlock_set((unsigned int)error_type, "operator_error"); |
| 471 | - (void) flush_ta(); | ||
| 472 | - } else { | 472 | + flush_ta(); |
| 473 | + } | ||
| 474 | + else | ||
| 475 | + { | ||
| 473 | lib3270_ring_bell(NULL); | 476 | lib3270_ring_bell(NULL); |
| 474 | } | 477 | } |
| 475 | } | 478 | } |
| @@ -652,7 +655,7 @@ static Boolean ins_prep(int faddr, int baddr, int count) | @@ -652,7 +655,7 @@ static Boolean ins_prep(int faddr, int baddr, int count) | ||
| 652 | while (need && (xaddr != next_faddr)) { | 655 | while (need && (xaddr != next_faddr)) { |
| 653 | if (h3270.ea_buf[xaddr].cc == EBC_null) | 656 | if (h3270.ea_buf[xaddr].cc == EBC_null) |
| 654 | need--; | 657 | need--; |
| 655 | - else if (toggled(LIB3270_TOGGLE_BLANK_FILL) && | 658 | + else if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL) && |
| 656 | ((h3270.ea_buf[xaddr].cc == EBC_space) || | 659 | ((h3270.ea_buf[xaddr].cc == EBC_space) || |
| 657 | (h3270.ea_buf[xaddr].cc == EBC_underscore))) { | 660 | (h3270.ea_buf[xaddr].cc == EBC_underscore))) { |
| 658 | if (tb_start == -1) | 661 | if (tb_start == -1) |
| @@ -770,7 +773,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -770,7 +773,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 770 | operator_error(KL_OERR_PROTECTED); | 773 | operator_error(KL_OERR_PROTECTED); |
| 771 | return False; | 774 | return False; |
| 772 | } | 775 | } |
| 773 | - if (appres.numeric_lock && FA_IS_NUMERIC(fa) && | 776 | + if (h3270.numeric_lock && FA_IS_NUMERIC(fa) && |
| 774 | !((code >= EBC_0 && code <= EBC_9) || | 777 | !((code >= EBC_0 && code <= EBC_9) || |
| 775 | code == EBC_minus || code == EBC_period)) { | 778 | code == EBC_minus || code == EBC_period)) { |
| 776 | operator_error(KL_OERR_NUMERIC); | 779 | operator_error(KL_OERR_NUMERIC); |
| @@ -795,7 +798,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -795,7 +798,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 795 | /* Add the character. */ | 798 | /* Add the character. */ |
| 796 | if (h3270.ea_buf[baddr].cc == EBC_so) { | 799 | if (h3270.ea_buf[baddr].cc == EBC_so) { |
| 797 | 800 | ||
| 798 | - if (toggled(LIB3270_TOGGLE_INSERT)) { | 801 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT)) { |
| 799 | if (!ins_prep(faddr, baddr, 1)) | 802 | if (!ins_prep(faddr, baddr, 1)) |
| 800 | return False; | 803 | return False; |
| 801 | } else { | 804 | } else { |
| @@ -832,7 +835,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -832,7 +835,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 832 | /* fall through... */ | 835 | /* fall through... */ |
| 833 | case DBCS_LEFT: | 836 | case DBCS_LEFT: |
| 834 | if (why == DBCS_ATTRIBUTE) { | 837 | if (why == DBCS_ATTRIBUTE) { |
| 835 | - if (toggled(LIB3270_TOGGLE_INSERT)) { | 838 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT)) { |
| 836 | if (!ins_prep(faddr, baddr, 1)) | 839 | if (!ins_prep(faddr, baddr, 1)) |
| 837 | return False; | 840 | return False; |
| 838 | } else { | 841 | } else { |
| @@ -849,7 +852,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -849,7 +852,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 849 | } else { | 852 | } else { |
| 850 | Boolean was_si; | 853 | Boolean was_si; |
| 851 | 854 | ||
| 852 | - if (toggled(LIB3270_TOGGLE_INSERT)) { | 855 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT)) { |
| 853 | /* | 856 | /* |
| 854 | * Inserting SBCS into a DBCS subfield. | 857 | * Inserting SBCS into a DBCS subfield. |
| 855 | * If this is the first position, we | 858 | * If this is the first position, we |
| @@ -906,7 +909,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -906,7 +909,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 906 | break; | 909 | break; |
| 907 | default: | 910 | default: |
| 908 | case DBCS_NONE: | 911 | case DBCS_NONE: |
| 909 | - if (toggled(LIB3270_TOGGLE_INSERT) && !ins_prep(faddr, baddr, 1)) | 912 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_INSERT) && !ins_prep(faddr, baddr, 1)) |
| 910 | return False; | 913 | return False; |
| 911 | break; | 914 | break; |
| 912 | } | 915 | } |
| @@ -916,7 +919,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | @@ -916,7 +919,7 @@ static Boolean key_Character(int code, Boolean with_ge, Boolean pasting, Boolean | ||
| 916 | INC_BA(baddr); | 919 | INC_BA(baddr); |
| 917 | 920 | ||
| 918 | /* Replace leading nulls with blanks, if desired. */ | 921 | /* Replace leading nulls with blanks, if desired. */ |
| 919 | - if (h3270.formatted && toggled(BLANK_FILL)) { | 922 | + if (h3270.formatted && lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL)) { |
| 920 | register int baddr_fill = baddr; | 923 | register int baddr_fill = baddr; |
| 921 | 924 | ||
| 922 | DEC_BA(baddr_fill); | 925 | DEC_BA(baddr_fill); |
| @@ -1047,7 +1050,7 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | @@ -1047,7 +1050,7 @@ key_WCharacter(unsigned char code[], Boolean *skipped) | ||
| 1047 | } | 1050 | } |
| 1048 | 1051 | ||
| 1049 | /* Numeric? */ | 1052 | /* Numeric? */ |
| 1050 | - if (appres.numeric_lock && FA_IS_NUMERIC(fa)) { | 1053 | + if (h3270.numeric_lock && FA_IS_NUMERIC(fa)) { |
| 1051 | operator_error(KL_OERR_NUMERIC); | 1054 | operator_error(KL_OERR_NUMERIC); |
| 1052 | return False; | 1055 | return False; |
| 1053 | } | 1056 | } |
| @@ -1250,7 +1253,7 @@ retry: | @@ -1250,7 +1253,7 @@ retry: | ||
| 1250 | 1253 | ||
| 1251 | if (done) { | 1254 | if (done) { |
| 1252 | /* Implement blank fill mode. */ | 1255 | /* Implement blank fill mode. */ |
| 1253 | - if (toggled(BLANK_FILL)) { | 1256 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_BLANK_FILL)) { |
| 1254 | xaddr = faddr; | 1257 | xaddr = faddr; |
| 1255 | INC_BA(xaddr); | 1258 | INC_BA(xaddr); |
| 1256 | while (xaddr != baddr) { | 1259 | while (xaddr != baddr) { |
| @@ -1505,7 +1508,7 @@ do_reset(Boolean explicit) | @@ -1505,7 +1508,7 @@ do_reset(Boolean explicit) | ||
| 1505 | #if defined(X3270_FT) /*[*/ | 1508 | #if defined(X3270_FT) /*[*/ |
| 1506 | || lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE | 1509 | || lib3270_get_ft_state(&h3270) != LIB3270_FT_STATE_NONE |
| 1507 | #endif /*]*/ | 1510 | #endif /*]*/ |
| 1508 | - || (!appres.unlock_delay) // && !sms_in_macro()) | 1511 | + || (!h3270.unlock_delay) // && !sms_in_macro()) |
| 1509 | || (unlock_delay_time != 0 && (time(NULL) - unlock_delay_time) > 1)) { | 1512 | || (unlock_delay_time != 0 && (time(NULL) - unlock_delay_time) > 1)) { |
| 1510 | kybdlock_clr(-1, "do_reset"); | 1513 | kybdlock_clr(-1, "do_reset"); |
| 1511 | } else if (kybdlock & | 1514 | } else if (kybdlock & |
| @@ -3010,7 +3013,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -3010,7 +3013,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
| 3010 | return len-1; /* wrapped */ | 3013 | return len-1; /* wrapped */ |
| 3011 | 3014 | ||
| 3012 | /* Jump cursor over left margin. */ | 3015 | /* Jump cursor over left margin. */ |
| 3013 | - if (toggled(MARGINED_PASTE) && | 3016 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) && |
| 3014 | BA_TO_COL(session->cursor_addr) < orig_col) { | 3017 | BA_TO_COL(session->cursor_addr) < orig_col) { |
| 3015 | if (!remargin(orig_col)) | 3018 | if (!remargin(orig_col)) |
| 3016 | return len-1; | 3019 | return len-1; |
| @@ -3291,7 +3294,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -3291,7 +3294,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
| 3291 | 3294 | ||
| 3292 | switch (state) { | 3295 | switch (state) { |
| 3293 | case BASE: | 3296 | case BASE: |
| 3294 | - if (toggled(MARGINED_PASTE) && | 3297 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) && |
| 3295 | BA_TO_COL(session->cursor_addr) < orig_col) { | 3298 | BA_TO_COL(session->cursor_addr) < orig_col) { |
| 3296 | (void) remargin(orig_col); | 3299 | (void) remargin(orig_col); |
| 3297 | } | 3300 | } |
| @@ -3300,7 +3303,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | @@ -3300,7 +3303,7 @@ LIB3270_EXPORT int lib3270_emulate_input(H3270 *session, char *s, int len, int p | ||
| 3300 | case HEX: | 3303 | case HEX: |
| 3301 | key_ACharacter((unsigned char) literal, KT_STD, ia, &skipped); | 3304 | key_ACharacter((unsigned char) literal, KT_STD, ia, &skipped); |
| 3302 | state = BASE; | 3305 | state = BASE; |
| 3303 | - if (toggled(MARGINED_PASTE) && | 3306 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE) && |
| 3304 | BA_TO_COL(session->cursor_addr) < orig_col) { | 3307 | BA_TO_COL(session->cursor_addr) < orig_col) { |
| 3305 | (void) remargin(orig_col); | 3308 | (void) remargin(orig_col); |
| 3306 | } | 3309 | } |
paste.c
| @@ -107,7 +107,7 @@ | @@ -107,7 +107,7 @@ | ||
| 107 | int faddr; | 107 | int faddr; |
| 108 | unsigned char fa; | 108 | unsigned char fa; |
| 109 | 109 | ||
| 110 | - if(toggled(MARGINED_PASTE)) | 110 | + if(lib3270_get_toggle(&h3270,LIB3270_TOGGLE_MARGINED_PASTE)) |
| 111 | { | 111 | { |
| 112 | baddr = session->cursor_addr; | 112 | baddr = session->cursor_addr; |
| 113 | while(BA_TO_COL(baddr) < lmargin) | 113 | while(BA_TO_COL(baddr) < lmargin) |
| @@ -138,7 +138,7 @@ | @@ -138,7 +138,7 @@ | ||
| 138 | static int paste_char(H3270 *session, PASTE_DATA *data, unsigned char c) | 138 | static int paste_char(H3270 *session, PASTE_DATA *data, unsigned char c) |
| 139 | { | 139 | { |
| 140 | 140 | ||
| 141 | - if(toggled(SMART_PASTE)) | 141 | + if(lib3270_get_toggle(session,SMART_PASTE)) |
| 142 | { | 142 | { |
| 143 | int faddr = find_field_attribute(session,session->cursor_addr); | 143 | int faddr = find_field_attribute(session,session->cursor_addr); |
| 144 | if(FA_IS_PROTECTED(session->ea_buf[faddr].fa)) | 144 | if(FA_IS_PROTECTED(session->ea_buf[faddr].fa)) |
| @@ -226,7 +226,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | @@ -226,7 +226,7 @@ LIB3270_EXPORT int lib3270_set_string(H3270 *h, const unsigned char *str) | ||
| 226 | } | 226 | } |
| 227 | str++; | 227 | str++; |
| 228 | 228 | ||
| 229 | - if(IN_3270 && toggled(MARGINED_PASTE) && BA_TO_COL(h->cursor_addr) < data.orig_col) | 229 | + if(IN_3270 && lib3270_get_toggle(h,LIB3270_TOGGLE_MARGINED_PASTE) && BA_TO_COL(h->cursor_addr) < data.orig_col) |
| 230 | { | 230 | { |
| 231 | if(!remargin(h,data.orig_col)) | 231 | if(!remargin(h,data.orig_col)) |
| 232 | last = 0; | 232 | last = 0; |
proxy.c
| @@ -35,35 +35,39 @@ | @@ -35,35 +35,39 @@ | ||
| 35 | * proxy.c | 35 | * proxy.c |
| 36 | * This module implements various kinds of proxies. | 36 | * This module implements various kinds of proxies. |
| 37 | */ | 37 | */ |
| 38 | + | ||
| 38 | #ifdef _WIN32 | 39 | #ifdef _WIN32 |
| 39 | #include <winsock2.h> | 40 | #include <winsock2.h> |
| 40 | #include <windows.h> | 41 | #include <windows.h> |
| 41 | #endif // _WIN32 | 42 | #endif // _WIN32 |
| 42 | 43 | ||
| 43 | #include "globals.h" | 44 | #include "globals.h" |
| 44 | -#if !defined(PR3287) /*[*/ | 45 | + |
| 45 | #include "appres.h" | 46 | #include "appres.h" |
| 46 | #include "resources.h" | 47 | #include "resources.h" |
| 47 | -#endif /*]*/ | ||
| 48 | 48 | ||
| 49 | #ifndef ANDROID | 49 | #ifndef ANDROID |
| 50 | #include <stdlib.h> | 50 | #include <stdlib.h> |
| 51 | #endif | 51 | #endif |
| 52 | 52 | ||
| 53 | #if defined(_WIN32) | 53 | #if defined(_WIN32) |
| 54 | + | ||
| 54 | #include <ws2tcpip.h> | 55 | #include <ws2tcpip.h> |
| 56 | + | ||
| 55 | #else | 57 | #else |
| 56 | 58 | ||
| 57 | -#include <malloc.h> | ||
| 58 | -#include <sys/socket.h> | ||
| 59 | -#include <sys/ioctl.h> | ||
| 60 | -#include <netinet/in.h> | ||
| 61 | -#include <netdb.h> | ||
| 62 | -#include <arpa/inet.h> | ||
| 63 | -#if defined(HAVE_SYS_SELECT_H) /*[*/ | ||
| 64 | -#include <sys/select.h> /* fd_set declaration */ | ||
| 65 | -#endif /*]*/ | ||
| 66 | -#endif /*]*/ | 59 | + #include <malloc.h> |
| 60 | + #include <sys/socket.h> | ||
| 61 | + #include <sys/ioctl.h> | ||
| 62 | + #include <netinet/in.h> | ||
| 63 | + #include <netdb.h> | ||
| 64 | + #include <arpa/inet.h> | ||
| 65 | + | ||
| 66 | +// #if defined(HAVE_SYS_SELECT_H) | ||
| 67 | +// #include <sys/select.h> | ||
| 68 | +// #endif | ||
| 69 | + | ||
| 70 | +#endif | ||
| 67 | 71 | ||
| 68 | #include "api.h" | 72 | #include "api.h" |
| 69 | 73 | ||
| @@ -76,30 +80,32 @@ | @@ -76,30 +80,32 @@ | ||
| 76 | #include "w3miscc.h" | 80 | #include "w3miscc.h" |
| 77 | #include "screen.h" | 81 | #include "screen.h" |
| 78 | 82 | ||
| 79 | -#if defined(PR3287) /*[*/ | ||
| 80 | -extern char *proxy_spec; | ||
| 81 | -#endif /*]*/ | 83 | +// #if defined(PR3287) |
| 84 | +// extern char *proxy_spec; | ||
| 85 | +// #endif | ||
| 82 | 86 | ||
| 83 | /* | 87 | /* |
| 84 | * Supported proxy types. | 88 | * Supported proxy types. |
| 85 | * | 89 | * |
| 86 | * At some point we will add SOCKS. | 90 | * At some point we will add SOCKS. |
| 87 | */ | 91 | */ |
| 88 | -enum { | ||
| 89 | - PT_NONE, | ||
| 90 | - PT_PASSTHRU, /* Sun telnet-passthru */ | ||
| 91 | - PT_HTTP, /* RFC 2817 CONNECT tunnel */ | ||
| 92 | - PT_TELNET, /* 'connect host port' proxy */ | ||
| 93 | - PT_SOCKS4, /* SOCKS version 4 (or 4A if necessary) */ | ||
| 94 | - PT_SOCKS4A, /* SOCKS version 4A (force remote name resolution) */ | ||
| 95 | - PT_SOCKS5, /* SOCKS version 5 (RFC 1928) */ | ||
| 96 | - PT_SOCKS5D, /* SOCKS version 5 (force remote name resolution) */ | 92 | +enum |
| 93 | +{ | ||
| 94 | + PT_NONE, | ||
| 95 | + PT_PASSTHRU, /**< Sun telnet-passthru */ | ||
| 96 | + PT_HTTP, /**< RFC 2817 CONNECT tunnel */ | ||
| 97 | + PT_TELNET, /**< 'connect host port' proxy */ | ||
| 98 | + PT_SOCKS4, /**< SOCKS version 4 (or 4A if necessary) */ | ||
| 99 | + PT_SOCKS4A, /**< SOCKS version 4A (force remote name resolution) */ | ||
| 100 | + PT_SOCKS5, /**< SOCKS version 5 (RFC 1928) */ | ||
| 101 | + PT_SOCKS5D, /**< SOCKS version 5 (force remote name resolution) */ | ||
| 97 | PT_MAX | 102 | PT_MAX |
| 98 | } proxytype_t; | 103 | } proxytype_t; |
| 99 | 104 | ||
| 100 | /* proxy type names -- keep these in sync with proxytype_t! */ | 105 | /* proxy type names -- keep these in sync with proxytype_t! */ |
| 101 | -char *type_name[] = { | ||
| 102 | - "unknown", | 106 | +char *type_name[] = |
| 107 | +{ | ||
| 108 | + "unknown", | ||
| 103 | "passthru", | 109 | "passthru", |
| 104 | "HTTP", | 110 | "HTTP", |
| 105 | "TELNET", | 111 | "TELNET", |
| @@ -138,8 +144,7 @@ static int proxy_socks4(int fd, char *host, unsigned short port, int force_a); | @@ -138,8 +144,7 @@ static int proxy_socks4(int fd, char *host, unsigned short port, int force_a); | ||
| 138 | static int proxy_socks5(int fd, char *host, unsigned short port, int force_d); | 144 | static int proxy_socks5(int fd, char *host, unsigned short port, int force_d); |
| 139 | 145 | ||
| 140 | 146 | ||
| 141 | -char * | ||
| 142 | -proxy_type_name(int type) | 147 | +char * proxy_type_name(int type) |
| 143 | { | 148 | { |
| 144 | if (type < 1 || type >= PT_MAX) | 149 | if (type < 1 || type >= PT_MAX) |
| 145 | return "unknown"; | 150 | return "unknown"; |
| @@ -151,38 +156,35 @@ proxy_type_name(int type) | @@ -151,38 +156,35 @@ proxy_type_name(int type) | ||
| 151 | * Resolve the type, hostname and port for a proxy. | 156 | * Resolve the type, hostname and port for a proxy. |
| 152 | * Returns -1 for failure, 0 for no proxy, >0 (the proxy type) for success. | 157 | * Returns -1 for failure, 0 for no proxy, >0 (the proxy type) for success. |
| 153 | */ | 158 | */ |
| 154 | -int | ||
| 155 | -proxy_setup(char **phost, char **pport) | 159 | +int proxy_setup(H3270 *session, char **phost, char **pport) |
| 156 | { | 160 | { |
| 157 | - char *proxy; | ||
| 158 | - char *colon; | ||
| 159 | - int sl; | 161 | + char * proxy = session->proxy; |
| 162 | + char * colon; | ||
| 163 | + int sl; | ||
| 160 | 164 | ||
| 161 | -#if defined(PR3287) /*[*/ | ||
| 162 | - proxy = proxy_spec; | ||
| 163 | -#else /*][*/ | ||
| 164 | - proxy = appres.proxy; | ||
| 165 | -#endif /*]*/ | ||
| 166 | - if (proxy == CN) | ||
| 167 | - return PT_NONE; | 165 | + if(!proxy) |
| 166 | + return PT_NONE; | ||
| 168 | 167 | ||
| 169 | - if ((colon = strchr(proxy, ':')) == CN || (colon == proxy)) { | ||
| 170 | - popup_an_error(NULL,"Invalid proxy syntax"); | 168 | + if ((colon = strchr(proxy, ':')) == CN || (colon == proxy)) |
| 169 | + { | ||
| 170 | + popup_an_error(session,_( "Invalid proxy syntax" ) ); | ||
| 171 | return -1; | 171 | return -1; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | sl = colon - proxy; | 174 | sl = colon - proxy; |
| 175 | - if (sl == strlen(PROXY_PASSTHRU) && | ||
| 176 | - !strncasecmp(proxy, PROXY_PASSTHRU, sl)) { | ||
| 177 | - | 175 | + if (sl == strlen(PROXY_PASSTHRU) && !strncasecmp(proxy, PROXY_PASSTHRU, sl)) |
| 176 | + { | ||
| 178 | if (parse_host_port(colon + 1, phost, pport) < 0) | 177 | if (parse_host_port(colon + 1, phost, pport) < 0) |
| 179 | - return -1; | 178 | + return -1; |
| 179 | + | ||
| 180 | if (*pport == CN) | 180 | if (*pport == CN) |
| 181 | - *pport = NewString(PORT_PASSTHRU); | 181 | + *pport = NewString(PORT_PASSTHRU); |
| 182 | + | ||
| 182 | return PT_PASSTHRU; | 183 | return PT_PASSTHRU; |
| 183 | } | 184 | } |
| 184 | - if (sl == strlen(PROXY_HTTP) && | ||
| 185 | - !strncasecmp(proxy, PROXY_HTTP, sl)) { | 185 | + |
| 186 | + if (sl == strlen(PROXY_HTTP) && !strncasecmp(proxy, PROXY_HTTP, sl)) | ||
| 187 | + { | ||
| 186 | 188 | ||
| 187 | if (parse_host_port(colon + 1, phost, pport) < 0) | 189 | if (parse_host_port(colon + 1, phost, pport) < 0) |
| 188 | return -1; | 190 | return -1; |
| @@ -190,54 +192,66 @@ proxy_setup(char **phost, char **pport) | @@ -190,54 +192,66 @@ proxy_setup(char **phost, char **pport) | ||
| 190 | *pport = NewString(PORT_HTTP); | 192 | *pport = NewString(PORT_HTTP); |
| 191 | return PT_HTTP; | 193 | return PT_HTTP; |
| 192 | } | 194 | } |
| 193 | - if (sl == strlen(PROXY_TELNET) && | ||
| 194 | - !strncasecmp(proxy, PROXY_TELNET, sl)) { | 195 | + |
| 196 | + if (sl == strlen(PROXY_TELNET) && !strncasecmp(proxy, PROXY_TELNET, sl)) | ||
| 197 | + { | ||
| 195 | 198 | ||
| 196 | if (parse_host_port(colon + 1, phost, pport) < 0) | 199 | if (parse_host_port(colon + 1, phost, pport) < 0) |
| 197 | return -1; | 200 | return -1; |
| 198 | - if (*pport == CN) { | ||
| 199 | - popup_an_error(NULL,"Must specify port for telnet proxy"); | 201 | + if (*pport == CN) |
| 202 | + { | ||
| 203 | + popup_an_error(session,_( "Must specify port for telnet proxy" ) ); | ||
| 200 | return -1; | 204 | return -1; |
| 201 | } | 205 | } |
| 202 | return PT_TELNET; | 206 | return PT_TELNET; |
| 203 | } | 207 | } |
| 204 | - if (sl == strlen(PROXY_SOCKS4) && | ||
| 205 | - !strncasecmp(proxy, PROXY_SOCKS4, sl)) { | ||
| 206 | 208 | ||
| 209 | + if (sl == strlen(PROXY_SOCKS4) && !strncasecmp(proxy, PROXY_SOCKS4, sl)) | ||
| 210 | + { | ||
| 207 | if (parse_host_port(colon + 1, phost, pport) < 0) | 211 | if (parse_host_port(colon + 1, phost, pport) < 0) |
| 208 | - return -1; | 212 | + return -1; |
| 213 | + | ||
| 209 | if (*pport == CN) | 214 | if (*pport == CN) |
| 210 | - *pport = NewString(PORT_SOCKS4); | 215 | + *pport = NewString(PORT_SOCKS4); |
| 216 | + | ||
| 211 | return PT_SOCKS4; | 217 | return PT_SOCKS4; |
| 212 | } | 218 | } |
| 213 | - if (sl == strlen(PROXY_SOCKS4A) && | ||
| 214 | - !strncasecmp(proxy, PROXY_SOCKS4A, sl)) { | ||
| 215 | 219 | ||
| 220 | + if (sl == strlen(PROXY_SOCKS4A) && !strncasecmp(proxy, PROXY_SOCKS4A, sl)) | ||
| 221 | + { | ||
| 216 | if (parse_host_port(colon + 1, phost, pport) < 0) | 222 | if (parse_host_port(colon + 1, phost, pport) < 0) |
| 217 | - return -1; | 223 | + return -1; |
| 224 | + | ||
| 218 | if (*pport == CN) | 225 | if (*pport == CN) |
| 219 | - *pport = NewString(PORT_SOCKS4A); | 226 | + *pport = NewString(PORT_SOCKS4A); |
| 227 | + | ||
| 220 | return PT_SOCKS4A; | 228 | return PT_SOCKS4A; |
| 221 | } | 229 | } |
| 222 | - if (sl == strlen(PROXY_SOCKS5) && | ||
| 223 | - !strncasecmp(proxy, PROXY_SOCKS5, sl)) { | ||
| 224 | 230 | ||
| 231 | + if (sl == strlen(PROXY_SOCKS5) && !strncasecmp(proxy, PROXY_SOCKS5, sl)) | ||
| 232 | + { | ||
| 225 | if (parse_host_port(colon + 1, phost, pport) < 0) | 233 | if (parse_host_port(colon + 1, phost, pport) < 0) |
| 226 | - return -1; | 234 | + return -1; |
| 235 | + | ||
| 227 | if (*pport == CN) | 236 | if (*pport == CN) |
| 228 | - *pport = NewString(PORT_SOCKS5); | 237 | + *pport = NewString(PORT_SOCKS5); |
| 238 | + | ||
| 229 | return PT_SOCKS5; | 239 | return PT_SOCKS5; |
| 230 | } | 240 | } |
| 231 | - if (sl == strlen(PROXY_SOCKS5D) && | ||
| 232 | - !strncasecmp(proxy, PROXY_SOCKS5D, sl)) { | ||
| 233 | 241 | ||
| 242 | + if (sl == strlen(PROXY_SOCKS5D) && !strncasecmp(proxy, PROXY_SOCKS5D, sl)) | ||
| 243 | + { | ||
| 234 | if (parse_host_port(colon + 1, phost, pport) < 0) | 244 | if (parse_host_port(colon + 1, phost, pport) < 0) |
| 235 | - return -1; | 245 | + return -1; |
| 246 | + | ||
| 236 | if (*pport == CN) | 247 | if (*pport == CN) |
| 237 | - *pport = NewString(PORT_SOCKS5D); | 248 | + *pport = NewString(PORT_SOCKS5D); |
| 249 | + | ||
| 238 | return PT_SOCKS5D; | 250 | return PT_SOCKS5D; |
| 239 | } | 251 | } |
| 240 | - popup_an_error(NULL,"Invalid proxy type '%.*s'", sl, proxy); | 252 | + |
| 253 | + popup_an_error(session,"Invalid proxy type '%.*s'", sl, proxy); | ||
| 254 | + | ||
| 241 | return -1; | 255 | return -1; |
| 242 | } | 256 | } |
| 243 | 257 |
proxyc.h
| @@ -17,6 +17,6 @@ | @@ -17,6 +17,6 @@ | ||
| 17 | * Declarations for proxy.c. | 17 | * Declarations for proxy.c. |
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | -LIB3270_INTERNAL int proxy_setup(char **phost, char **pport); | ||
| 21 | -LIB3270_INTERNAL int proxy_negotiate(int type, int fd, char *host, unsigned short port); | ||
| 22 | -LIB3270_INTERNAL char *proxy_type_name(int type); | 20 | +LIB3270_INTERNAL int proxy_setup(H3270 *session, char **phost, char **pport); |
| 21 | +LIB3270_INTERNAL int proxy_negotiate(int type, int fd, char *host, unsigned short port); | ||
| 22 | +LIB3270_INTERNAL char * proxy_type_name(int type); |
| @@ -48,7 +48,9 @@ | @@ -48,7 +48,9 @@ | ||
| 48 | #include <netdb.h> | 48 | #include <netdb.h> |
| 49 | #endif /*]*/ | 49 | #endif /*]*/ |
| 50 | 50 | ||
| 51 | -#include <stdlib.h> | 51 | +#ifndef ANDROID |
| 52 | + #include <stdlib.h> | ||
| 53 | +#endif // !ANDROID | ||
| 52 | 54 | ||
| 53 | #include "api.h" | 55 | #include "api.h" |
| 54 | 56 | ||
| @@ -202,8 +204,7 @@ do_qr_rpqnames(void) | @@ -202,8 +204,7 @@ do_qr_rpqnames(void) | ||
| 202 | } | 204 | } |
| 203 | break; | 205 | break; |
| 204 | 206 | ||
| 205 | - case RPQ_TIMESTAMP: /* program build time | ||
| 206 | - (yyyymmddhhmmss bcd) */ | 207 | + case RPQ_TIMESTAMP: /* program build time (yyyymmddhhmmss bcd) */ |
| 207 | x = strlen(build_rpq_timestamp); | 208 | x = strlen(build_rpq_timestamp); |
| 208 | omit_due_space_limit = ((x+1)/2 > remaining); | 209 | omit_due_space_limit = ((x+1)/2 > remaining); |
| 209 | if (!omit_due_space_limit) { | 210 | if (!omit_due_space_limit) { |
| @@ -220,8 +221,7 @@ do_qr_rpqnames(void) | @@ -220,8 +221,7 @@ do_qr_rpqnames(void) | ||
| 220 | } | 221 | } |
| 221 | 222 | ||
| 222 | if (omit_due_space_limit) | 223 | if (omit_due_space_limit) |
| 223 | - rpq_warning("RPQ %s term omitted due to insufficient " | ||
| 224 | - "space", rpq_keywords[j].text); | 224 | + rpq_warning("RPQ %s term omitted due to insufficient space", rpq_keywords[j].text); |
| 225 | /* | 225 | /* |
| 226 | * The item is built, insert item length as needed and | 226 | * The item is built, insert item length as needed and |
| 227 | * adjust space remaining. | 227 | * adjust space remaining. |
| @@ -367,8 +367,7 @@ select_rpq_terms(void) | @@ -367,8 +367,7 @@ select_rpq_terms(void) | ||
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | /* Utility function used by the RPQNAMES query reply. */ | 369 | /* Utility function used by the RPQNAMES query reply. */ |
| 370 | -static int | ||
| 371 | -get_rpq_timezone(void) | 370 | +static int get_rpq_timezone(void) |
| 372 | { | 371 | { |
| 373 | /* | 372 | /* |
| 374 | * Return the signed number of minutes we're offset from UTC. | 373 | * Return the signed number of minutes we're offset from UTC. |
| @@ -402,8 +401,7 @@ get_rpq_timezone(void) | @@ -402,8 +401,7 @@ get_rpq_timezone(void) | ||
| 402 | 401 | ||
| 403 | x = strtol(p1, &p2, 10); | 402 | x = strtol(p1, &p2, 10); |
| 404 | if (errno != 0) { | 403 | if (errno != 0) { |
| 405 | - rpq_warning("RPQ TIMEZONE term is invalid - " | ||
| 406 | - "use +/-hhmm"); | 404 | + rpq_warning("RPQ TIMEZONE term is invalid - use +/-hhmm"); |
| 407 | return 4; | 405 | return 4; |
| 408 | } | 406 | } |
| 409 | if ((*p2 != '\0') && (*p2 != ':') && (!isspace(*p2))) | 407 | if ((*p2 != '\0') && (*p2 != ':') && (!isspace(*p2))) |
| @@ -412,8 +410,7 @@ get_rpq_timezone(void) | @@ -412,8 +410,7 @@ get_rpq_timezone(void) | ||
| 412 | hhmm = ldiv(x, 100L); | 410 | hhmm = ldiv(x, 100L); |
| 413 | 411 | ||
| 414 | if (hhmm.rem > 59L) { | 412 | if (hhmm.rem > 59L) { |
| 415 | - rpq_warning("RPQ TIMEZONE term is invalid - " | ||
| 416 | - "use +/-hhmm"); | 413 | + rpq_warning("RPQ TIMEZONE term is invalid - use +/-hhmm"); |
| 417 | return 4; | 414 | return 4; |
| 418 | } | 415 | } |
| 419 | 416 | ||
| @@ -424,15 +421,16 @@ get_rpq_timezone(void) | @@ -424,15 +421,16 @@ get_rpq_timezone(void) | ||
| 424 | * No override specified, try to get information from the | 421 | * No override specified, try to get information from the |
| 425 | * system. | 422 | * system. |
| 426 | */ | 423 | */ |
| 427 | - if ((here = time(NULL)) == (time_t)(-1)) { | ||
| 428 | - rpq_warning("RPQ: Unable to determine workstation " | ||
| 429 | - "local time"); | 424 | + if ((here = time(NULL)) == (time_t)(-1)) |
| 425 | + { | ||
| 426 | + rpq_warning("RPQ: Unable to determine workstation local time"); | ||
| 430 | return 1; | 427 | return 1; |
| 431 | } | 428 | } |
| 432 | memcpy(&here_tm, localtime(&here), sizeof(struct tm)); | 429 | memcpy(&here_tm, localtime(&here), sizeof(struct tm)); |
| 433 | - if ((utc_tm = gmtime(&here)) == NULL) { | ||
| 434 | - rpq_warning("RPQ: Unable to determine workstation UTC " | ||
| 435 | - "time"); | 430 | + |
| 431 | + if ((utc_tm = gmtime(&here)) == NULL) | ||
| 432 | + { | ||
| 433 | + rpq_warning("RPQ: Unable to determine workstation UTC time"); | ||
| 436 | return 2; | 434 | return 2; |
| 437 | } | 435 | } |
| 438 | 436 | ||
| @@ -502,15 +500,13 @@ get_rpq_user(unsigned char buf[], const int buflen) | @@ -502,15 +500,13 @@ get_rpq_user(unsigned char buf[], const int buflen) | ||
| 502 | if (isspace(c)) | 500 | if (isspace(c)) |
| 503 | continue; /* skip white space */ | 501 | continue; /* skip white space */ |
| 504 | if (!isxdigit(c)) { | 502 | if (!isxdigit(c)) { |
| 505 | - rpq_warning("RPQ USER term has non-hex " | ||
| 506 | - "character"); | 503 | + rpq_warning("RPQ USER term has non-hex character"); |
| 507 | break; | 504 | break; |
| 508 | } | 505 | } |
| 509 | x = (p_h - hexstr)/2; | 506 | x = (p_h - hexstr)/2; |
| 510 | if (x >= buflen) { | 507 | if (x >= buflen) { |
| 511 | x = buflen; | 508 | x = buflen; |
| 512 | - rpq_warning("RPQ USER term truncated after %d " | ||
| 513 | - "bytes", x); | 509 | + rpq_warning("RPQ USER term truncated after %d bytes", x); |
| 514 | break; /* too long, truncate */ | 510 | break; /* too long, truncate */ |
| 515 | } | 511 | } |
| 516 | 512 | ||
| @@ -529,8 +525,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | @@ -529,8 +525,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | ||
| 529 | */ | 525 | */ |
| 530 | is_first_hex_digit = ((strlen(hexstr) % 2) == 0); | 526 | is_first_hex_digit = ((strlen(hexstr) % 2) == 0); |
| 531 | if (!is_first_hex_digit) | 527 | if (!is_first_hex_digit) |
| 532 | - rpq_warning("RPQ USER term has odd number of hex " | ||
| 533 | - "digits"); | 528 | + rpq_warning("RPQ USER term has odd number of hex digits"); |
| 534 | *buf = 0; /* initialize first byte for possible implied | 529 | *buf = 0; /* initialize first byte for possible implied |
| 535 | leading zero */ | 530 | leading zero */ |
| 536 | for (p_h = &hexstr[0]; *p_h; p_h++) { | 531 | for (p_h = &hexstr[0]; *p_h; p_h++) { |
| @@ -555,8 +550,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | @@ -555,8 +550,7 @@ get_rpq_user(unsigned char buf[], const int buflen) | ||
| 555 | 550 | ||
| 556 | if ( x >= buflen) { | 551 | if ( x >= buflen) { |
| 557 | x = buflen; | 552 | x = buflen; |
| 558 | - rpq_warning("RPQ USER term truncated after %d " | ||
| 559 | - "characters", x); | 553 | + rpq_warning("RPQ USER term truncated after %d characters", x); |
| 560 | break; | 554 | break; |
| 561 | } | 555 | } |
| 562 | 556 | ||
| @@ -630,8 +624,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -630,8 +624,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 630 | len = sizeof(struct in6_addr); | 624 | len = sizeof(struct in6_addr); |
| 631 | break; | 625 | break; |
| 632 | default: | 626 | default: |
| 633 | - rpq_warning("RPQ ADDRESS term has " | ||
| 634 | - "unrecognized family %u", | 627 | + rpq_warning("RPQ ADDRESS term has unrecognized family %u", |
| 635 | res->ai_family); | 628 | res->ai_family); |
| 636 | break; | 629 | break; |
| 637 | } | 630 | } |
| @@ -640,8 +633,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -640,8 +633,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 640 | x += len; | 633 | x += len; |
| 641 | (void) memcpy(buf, src, len); | 634 | (void) memcpy(buf, src, len); |
| 642 | } else { | 635 | } else { |
| 643 | - rpq_warning("RPQ ADDRESS term incomplete due " | ||
| 644 | - "to space limit"); | 636 | + rpq_warning("RPQ ADDRESS term incomplete due to space limit"); |
| 645 | } | 637 | } |
| 646 | /* Give back storage obtained by getaddrinfo */ | 638 | /* Give back storage obtained by getaddrinfo */ |
| 647 | freeaddrinfo(res); | 639 | freeaddrinfo(res); |
| @@ -670,8 +662,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -670,8 +662,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 670 | (void) memcpy(buf, &ia, sizeof(in_addr_t)); | 662 | (void) memcpy(buf, &ia, sizeof(in_addr_t)); |
| 671 | x += sizeof(in_addr_t); | 663 | x += sizeof(in_addr_t); |
| 672 | } else { | 664 | } else { |
| 673 | - rpq_warning("RPQ ADDRESS term incomplete due to " | ||
| 674 | - "space limit"); | 665 | + rpq_warning("RPQ ADDRESS term incomplete due to space limit"); |
| 675 | } | 666 | } |
| 676 | #endif /*]*/ | 667 | #endif /*]*/ |
| 677 | free(rpqtext); | 668 | free(rpqtext); |
| @@ -704,16 +695,14 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -704,16 +695,14 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 704 | break; | 695 | break; |
| 705 | #endif /*]*/ | 696 | #endif /*]*/ |
| 706 | default: | 697 | default: |
| 707 | - rpq_warning("RPQ ADDRESS term has unrecognized " | ||
| 708 | - "family %u", u.sa.sa_family); | 698 | + rpq_warning("RPQ ADDRESS term has unrecognized family %u", u.sa.sa_family); |
| 709 | break; | 699 | break; |
| 710 | } | 700 | } |
| 711 | if (x + len <= maxlen) { | 701 | if (x + len <= maxlen) { |
| 712 | (void) memcpy(buf, src, len); | 702 | (void) memcpy(buf, src, len); |
| 713 | x += len; | 703 | x += len; |
| 714 | } else { | 704 | } else { |
| 715 | - rpq_warning("RPQ ADDRESS term incomplete due to space " | ||
| 716 | - "limit"); | 705 | + rpq_warning("RPQ ADDRESS term incomplete due to space limit"); |
| 717 | } | 706 | } |
| 718 | } | 707 | } |
| 719 | return x; | 708 | return x; |
| @@ -721,38 +710,46 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -721,38 +710,46 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
| 721 | #endif /*]*/ | 710 | #endif /*]*/ |
| 722 | 711 | ||
| 723 | #define RPQ_WARNBUF_SIZE 1024 | 712 | #define RPQ_WARNBUF_SIZE 1024 |
| 724 | -static char *rpq_warnbuf = CN; | ||
| 725 | -static int rpq_wbcnt = 0; | 713 | +static char * rpq_warnbuf = CN; |
| 714 | +static int rpq_wbcnt = 0; | ||
| 726 | 715 | ||
| 727 | -static void | ||
| 728 | -rpq_warning(const char *fmt, ...) | 716 | +static void rpq_warning(const char *fmt, ...) |
| 729 | { | 717 | { |
| 730 | va_list a; | 718 | va_list a; |
| 731 | 719 | ||
| 732 | - /* Only accumulate RPQ warnings if they | 720 | + va_start(a, fmt); |
| 721 | + lib3270_write_va_log(&h3270,"RPQ",fmt,a); | ||
| 722 | + va_end(a); | ||
| 723 | + | ||
| 724 | + /* | ||
| 725 | + * Only accumulate RPQ warnings if they | ||
| 733 | * have not been displayed already. | 726 | * have not been displayed already. |
| 734 | */ | 727 | */ |
| 735 | - if (!rpq_complained) { | 728 | + if (!rpq_complained) |
| 729 | + { | ||
| 736 | va_start(a, fmt); | 730 | va_start(a, fmt); |
| 737 | if (rpq_warnbuf == CN) | 731 | if (rpq_warnbuf == CN) |
| 738 | rpq_warnbuf = Malloc(RPQ_WARNBUF_SIZE); | 732 | rpq_warnbuf = Malloc(RPQ_WARNBUF_SIZE); |
| 739 | - if (rpq_wbcnt < RPQ_WARNBUF_SIZE) { | 733 | + |
| 734 | + if (rpq_wbcnt < RPQ_WARNBUF_SIZE) | ||
| 735 | + { | ||
| 740 | *(rpq_warnbuf + rpq_wbcnt++) = '\n'; | 736 | *(rpq_warnbuf + rpq_wbcnt++) = '\n'; |
| 741 | *(rpq_warnbuf + rpq_wbcnt) = '\0'; | 737 | *(rpq_warnbuf + rpq_wbcnt) = '\0'; |
| 742 | } | 738 | } |
| 743 | - if (rpq_wbcnt < RPQ_WARNBUF_SIZE) { | ||
| 744 | - rpq_wbcnt += vsnprintf(rpq_warnbuf + rpq_wbcnt, | ||
| 745 | - RPQ_WARNBUF_SIZE - rpq_wbcnt, fmt, a); | 739 | + |
| 740 | + if (rpq_wbcnt < RPQ_WARNBUF_SIZE) | ||
| 741 | + { | ||
| 742 | + rpq_wbcnt += vsnprintf(rpq_warnbuf + rpq_wbcnt,RPQ_WARNBUF_SIZE - rpq_wbcnt, fmt, a); | ||
| 746 | } | 743 | } |
| 747 | va_end(a); | 744 | va_end(a); |
| 748 | } | 745 | } |
| 749 | } | 746 | } |
| 750 | 747 | ||
| 751 | -static void | ||
| 752 | -rpq_dump_warnings(void) | 748 | +static void rpq_dump_warnings(void) |
| 753 | { | 749 | { |
| 754 | /* If there's something to complain about, only complain once. */ | 750 | /* If there's something to complain about, only complain once. */ |
| 755 | - if (!rpq_complained && rpq_wbcnt) { | 751 | + if (!rpq_complained && rpq_wbcnt) |
| 752 | + { | ||
| 756 | popup_an_error(NULL,rpq_warnbuf); | 753 | popup_an_error(NULL,rpq_warnbuf); |
| 757 | rpq_wbcnt = 0; | 754 | rpq_wbcnt = 0; |
| 758 | rpq_complained = True; | 755 | rpq_complained = True; |
screen.c
| @@ -83,7 +83,7 @@ enum ts { TS_AUTO, TS_ON, TS_OFF }; | @@ -83,7 +83,7 @@ enum ts { TS_AUTO, TS_ON, TS_OFF }; | ||
| 83 | static void screen_update(H3270 *session, int bstart, int bend); | 83 | static void screen_update(H3270 *session, int bstart, int bend); |
| 84 | static void status_connect(H3270 *session, int ignored, void *dunno); | 84 | static void status_connect(H3270 *session, int ignored, void *dunno); |
| 85 | static void status_3270_mode(H3270 *session, int ignored, void *dunno); | 85 | static void status_3270_mode(H3270 *session, int ignored, void *dunno); |
| 86 | -static void status_printer(H3270 *session, int on, void *dunno); | 86 | +// static void status_printer(H3270 *session, int on, void *dunno); |
| 87 | static unsigned short color_from_fa(unsigned char fa); | 87 | static unsigned short color_from_fa(unsigned char fa); |
| 88 | 88 | ||
| 89 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 89 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| @@ -131,9 +131,9 @@ int screen_init(H3270 *session) | @@ -131,9 +131,9 @@ int screen_init(H3270 *session) | ||
| 131 | CHECK_SESSION_HANDLE(session); | 131 | CHECK_SESSION_HANDLE(session); |
| 132 | 132 | ||
| 133 | /* Set up callbacks for state changes. */ | 133 | /* Set up callbacks for state changes. */ |
| 134 | - lib3270_register_schange(session,ST_CONNECT, status_connect,0); | ||
| 135 | - lib3270_register_schange(session,ST_3270_MODE, status_3270_mode,0); | ||
| 136 | - lib3270_register_schange(session,ST_PRINTER, status_printer,0); | 134 | + lib3270_register_schange(session,LIB3270_STATE_CONNECT, status_connect,0); |
| 135 | + lib3270_register_schange(session,LIB3270_STATE_3270_MODE, status_3270_mode,0); | ||
| 136 | +// lib3270_register_schange(session,ST_PRINTER, status_printer,0); | ||
| 137 | 137 | ||
| 138 | /* Set up the controller. */ | 138 | /* Set up the controller. */ |
| 139 | ctlr_init(session,-1); | 139 | ctlr_init(session,-1); |
| @@ -338,7 +338,7 @@ static void screen_update(H3270 *session, int bstart, int bend) | @@ -338,7 +338,7 @@ static void screen_update(H3270 *session, int bstart, int bend) | ||
| 338 | } | 338 | } |
| 339 | else | 339 | else |
| 340 | { | 340 | { |
| 341 | - if (toggled(MONOCASE)) | 341 | + if (lib3270_get_toggle(session,MONOCASE)) |
| 342 | addch(session,baddr,asc2uc[ebc2asc[session->ea_buf[baddr].cc]],attr,&first,&last); | 342 | addch(session,baddr,asc2uc[ebc2asc[session->ea_buf[baddr].cc]],attr,&first,&last); |
| 343 | else | 343 | else |
| 344 | addch(session,baddr,ebc2asc[session->ea_buf[baddr].cc],attr,&first,&last); | 344 | addch(session,baddr,ebc2asc[session->ea_buf[baddr].cc],attr,&first,&last); |
| @@ -579,10 +579,12 @@ static void status_3270_mode(H3270 *session, int ignored unused, void *dunno) | @@ -579,10 +579,12 @@ static void status_3270_mode(H3270 *session, int ignored unused, void *dunno) | ||
| 579 | 579 | ||
| 580 | } | 580 | } |
| 581 | 581 | ||
| 582 | +/* | ||
| 582 | static void status_printer(H3270 *session, int on, void *dunno) | 583 | static void status_printer(H3270 *session, int on, void *dunno) |
| 583 | { | 584 | { |
| 584 | set_status(session,OIA_FLAG_PRINTER,on); | 585 | set_status(session,OIA_FLAG_PRINTER,on); |
| 585 | } | 586 | } |
| 587 | +*/ | ||
| 586 | 588 | ||
| 587 | void status_timing(H3270 *session, struct timeval *t0, struct timeval *t1) | 589 | void status_timing(H3270 *session, struct timeval *t0, struct timeval *t1) |
| 588 | { | 590 | { |
| @@ -43,7 +43,7 @@ | @@ -43,7 +43,7 @@ | ||
| 43 | #include <netinet/in.h> | 43 | #include <netinet/in.h> |
| 44 | #endif /*]*/ | 44 | #endif /*]*/ |
| 45 | #include "3270ds.h" | 45 | #include "3270ds.h" |
| 46 | -#include "appres.h" | 46 | +// #include "appres.h" |
| 47 | #include "screen.h" | 47 | #include "screen.h" |
| 48 | // #include "ctlr.h" | 48 | // #include "ctlr.h" |
| 49 | #include "resources.h" | 49 | #include "resources.h" |
| @@ -772,7 +772,7 @@ do_qr_color(void) | @@ -772,7 +772,7 @@ do_qr_color(void) | ||
| 772 | 772 | ||
| 773 | trace_ds("> QueryReply(Color)\n"); | 773 | trace_ds("> QueryReply(Color)\n"); |
| 774 | 774 | ||
| 775 | - color_max = appres.color8? 8: 16; /* report on 8 or 16 colors */ | 775 | + color_max = h3270.color8 ? 8: 16; /* report on 8 or 16 colors */ |
| 776 | 776 | ||
| 777 | space3270out(4 + 2*15); | 777 | space3270out(4 + 2*15); |
| 778 | *obptr++ = 0x00; /* no options */ | 778 | *obptr++ = 0x00; /* no options */ |
| @@ -904,7 +904,7 @@ do_qr_charsets(void) | @@ -904,7 +904,7 @@ do_qr_charsets(void) | ||
| 904 | if (!*standard_font) { | 904 | if (!*standard_font) { |
| 905 | /* special 3270 font, includes APL */ | 905 | /* special 3270 font, includes APL */ |
| 906 | *obptr++ = 0x01;/* SET 1: */ | 906 | *obptr++ = 0x01;/* SET 1: */ |
| 907 | - if (appres.apl_mode) | 907 | + if (h3270.apl_mode) |
| 908 | *obptr++ = 0x00;/* FLAGS: non-loadable, single-plane, | 908 | *obptr++ = 0x00;/* FLAGS: non-loadable, single-plane, |
| 909 | single-byte, no compare */ | 909 | single-byte, no compare */ |
| 910 | else | 910 | else |
telnet.c
| @@ -83,7 +83,7 @@ | @@ -83,7 +83,7 @@ | ||
| 83 | #include "tn3270e.h" | 83 | #include "tn3270e.h" |
| 84 | #include "3270ds.h" | 84 | #include "3270ds.h" |
| 85 | 85 | ||
| 86 | -#include "appres.h" | 86 | +// #include "appres.h" |
| 87 | 87 | ||
| 88 | #include "ansic.h" | 88 | #include "ansic.h" |
| 89 | #include "ctlrc.h" | 89 | #include "ctlrc.h" |
| @@ -521,7 +521,18 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -521,7 +521,18 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 521 | netrbuf = (unsigned char *)Malloc(BUFSZ); | 521 | netrbuf = (unsigned char *)Malloc(BUFSZ); |
| 522 | 522 | ||
| 523 | #if defined(X3270_ANSI) /*[*/ | 523 | #if defined(X3270_ANSI) /*[*/ |
| 524 | - if (!t_valid) { | 524 | + if (!t_valid) |
| 525 | + { | ||
| 526 | + vintr = parse_ctlchar("^C"); | ||
| 527 | + vquit = parse_ctlchar("^\\"); | ||
| 528 | + verase = parse_ctlchar("^H"); | ||
| 529 | + vkill = parse_ctlchar("^U"); | ||
| 530 | + veof = parse_ctlchar("^D"); | ||
| 531 | + vwerase = parse_ctlchar("^W"); | ||
| 532 | + vrprnt = parse_ctlchar("^R"); | ||
| 533 | + vlnext = parse_ctlchar("^V"); | ||
| 534 | + | ||
| 535 | +/* | ||
| 525 | vintr = parse_ctlchar(appres.intr); | 536 | vintr = parse_ctlchar(appres.intr); |
| 526 | vquit = parse_ctlchar(appres.quit); | 537 | vquit = parse_ctlchar(appres.quit); |
| 527 | verase = parse_ctlchar(appres.erase); | 538 | verase = parse_ctlchar(appres.erase); |
| @@ -530,6 +541,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -530,6 +541,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 530 | vwerase = parse_ctlchar(appres.werase); | 541 | vwerase = parse_ctlchar(appres.werase); |
| 531 | vrprnt = parse_ctlchar(appres.rprnt); | 542 | vrprnt = parse_ctlchar(appres.rprnt); |
| 532 | vlnext = parse_ctlchar(appres.lnext); | 543 | vlnext = parse_ctlchar(appres.lnext); |
| 544 | +*/ | ||
| 533 | t_valid = 1; | 545 | t_valid = 1; |
| 534 | } | 546 | } |
| 535 | #endif /*]*/ | 547 | #endif /*]*/ |
| @@ -540,7 +552,8 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -540,7 +552,8 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 540 | Replace(session->hostname, NewString(host)); | 552 | Replace(session->hostname, NewString(host)); |
| 541 | 553 | ||
| 542 | /* get the passthru host and port number */ | 554 | /* get the passthru host and port number */ |
| 543 | - if (session->passthru_host) { | 555 | + if (session->passthru_host) |
| 556 | + { | ||
| 544 | const char *hn = CN; | 557 | const char *hn = CN; |
| 545 | 558 | ||
| 546 | #ifndef ANDROID | 559 | #ifndef ANDROID |
| @@ -563,27 +576,35 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -563,27 +576,35 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 563 | passthru_port = sp->s_port; | 576 | passthru_port = sp->s_port; |
| 564 | else | 577 | else |
| 565 | passthru_port = htons(3514); | 578 | passthru_port = htons(3514); |
| 566 | - } else if (appres.proxy != CN && !proxy_type) { | ||
| 567 | - proxy_type = proxy_setup(&proxy_host, &proxy_portname); | ||
| 568 | - if (proxy_type > 0) { | ||
| 569 | - unsigned long lport; | 579 | + } |
| 580 | + else if(session->proxy != CN && !proxy_type) | ||
| 581 | + { | ||
| 582 | + proxy_type = proxy_setup(session, &proxy_host, &proxy_portname); | ||
| 583 | + | ||
| 584 | + if (proxy_type > 0) | ||
| 585 | + { | ||
| 586 | + unsigned long lport; | ||
| 570 | char *ptr; | 587 | char *ptr; |
| 571 | struct servent *sp; | 588 | struct servent *sp; |
| 572 | 589 | ||
| 573 | lport = strtoul(portname, &ptr, 0); | 590 | lport = strtoul(portname, &ptr, 0); |
| 574 | - if (ptr == portname || *ptr != '\0' || lport == 0L || | ||
| 575 | - lport & ~0xffff) { | ||
| 576 | - if (!(sp = getservbyname(portname, "tcp"))) { | ||
| 577 | - popup_an_error(NULL,"Unknown port number " | ||
| 578 | - "or service: %s", portname); | 591 | + if (ptr == portname || *ptr != '\0' || lport == 0L || lport & ~0xffff) |
| 592 | + { | ||
| 593 | + if (!(sp = getservbyname(portname, "tcp"))) | ||
| 594 | + { | ||
| 595 | + popup_an_error(session, _( "Unknown port number or service: %s" ), portname); | ||
| 579 | return -1; | 596 | return -1; |
| 580 | } | 597 | } |
| 581 | session->current_port = ntohs(sp->s_port); | 598 | session->current_port = ntohs(sp->s_port); |
| 582 | - } else | 599 | + } |
| 600 | + else | ||
| 601 | + { | ||
| 583 | session->current_port = (unsigned short)lport; | 602 | session->current_port = (unsigned short)lport; |
| 603 | + } | ||
| 584 | } | 604 | } |
| 605 | + | ||
| 585 | if (proxy_type < 0) | 606 | if (proxy_type < 0) |
| 586 | - return -1; | 607 | + return -1; |
| 587 | } | 608 | } |
| 588 | 609 | ||
| 589 | /* fill in the socket address of the given host */ | 610 | /* fill in the socket address of the given host */ |
| @@ -679,9 +700,9 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -679,9 +700,9 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 679 | } | 700 | } |
| 680 | 701 | ||
| 681 | /* set up temporary termtype */ | 702 | /* set up temporary termtype */ |
| 682 | - if (appres.termname == CN && session->std_ds_host) | 703 | + if (session->termname == CN && session->std_ds_host) |
| 683 | { | 704 | { |
| 684 | - (void) sprintf(ttype_tmpval, "IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num); | 705 | + sprintf(ttype_tmpval, "IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num); |
| 685 | session->termtype = ttype_tmpval; | 706 | session->termtype = ttype_tmpval; |
| 686 | } | 707 | } |
| 687 | 708 | ||
| @@ -932,7 +953,7 @@ void net_disconnect(H3270 *session) | @@ -932,7 +953,7 @@ void net_disconnect(H3270 *session) | ||
| 932 | trace_dsn("SENT disconnect\n"); | 953 | trace_dsn("SENT disconnect\n"); |
| 933 | 954 | ||
| 934 | /* Restore terminal type to its default. */ | 955 | /* Restore terminal type to its default. */ |
| 935 | - if (appres.termname == CN) | 956 | + if (session->termname == CN) |
| 936 | session->termtype = session->full_model_name; | 957 | session->termtype = session->full_model_name; |
| 937 | 958 | ||
| 938 | /* We're not connected to an LU any more. */ | 959 | /* We're not connected to an LU any more. */ |
| @@ -1216,7 +1237,7 @@ telnet_fsm(unsigned char c) | @@ -1216,7 +1237,7 @@ telnet_fsm(unsigned char c) | ||
| 1216 | } | 1237 | } |
| 1217 | trace_dsn("%s",see_chr); | 1238 | trace_dsn("%s",see_chr); |
| 1218 | if (!syncing) { | 1239 | if (!syncing) { |
| 1219 | - if (linemode && appres.onlcr && c == '\n') | 1240 | + if (linemode && h3270.onlcr && c == '\n') |
| 1220 | ansi_process((unsigned int) '\r'); | 1241 | ansi_process((unsigned int) '\r'); |
| 1221 | ansi_process((unsigned int) c); | 1242 | ansi_process((unsigned int) c); |
| 1222 | // sms_store(c); | 1243 | // sms_store(c); |
| @@ -1375,7 +1396,7 @@ telnet_fsm(unsigned char c) | @@ -1375,7 +1396,7 @@ telnet_fsm(unsigned char c) | ||
| 1375 | #endif /*]*/ | 1396 | #endif /*]*/ |
| 1376 | if (c == TELOPT_TN3270E && h3270.non_tn3270e_host) | 1397 | if (c == TELOPT_TN3270E && h3270.non_tn3270e_host) |
| 1377 | goto wont; | 1398 | goto wont; |
| 1378 | - if (c == TELOPT_TM && !appres.bsd_tm) | 1399 | + if (c == TELOPT_TM && !h3270.bsd_tm) |
| 1379 | goto wont; | 1400 | goto wont; |
| 1380 | 1401 | ||
| 1381 | if (!myopts[c]) { | 1402 | if (!myopts[c]) { |
| @@ -1383,8 +1404,7 @@ telnet_fsm(unsigned char c) | @@ -1383,8 +1404,7 @@ telnet_fsm(unsigned char c) | ||
| 1383 | myopts[c] = 1; | 1404 | myopts[c] = 1; |
| 1384 | will_opt[2] = c; | 1405 | will_opt[2] = c; |
| 1385 | net_rawout(will_opt, sizeof(will_opt)); | 1406 | net_rawout(will_opt, sizeof(will_opt)); |
| 1386 | - trace_dsn("SENT %s %s\n", cmd(WILL), | ||
| 1387 | - opt(c)); | 1407 | + trace_dsn("SENT %s %s\n", cmd(WILL), opt(c)); |
| 1388 | check_in3270(); | 1408 | check_in3270(); |
| 1389 | check_linemode(False); | 1409 | check_linemode(False); |
| 1390 | } | 1410 | } |
| @@ -2078,7 +2098,7 @@ net_hexansi_out(unsigned char *buf, int len) | @@ -2078,7 +2098,7 @@ net_hexansi_out(unsigned char *buf, int len) | ||
| 2078 | 2098 | ||
| 2079 | #if defined(X3270_TRACE) /*[*/ | 2099 | #if defined(X3270_TRACE) /*[*/ |
| 2080 | /* Trace the data. */ | 2100 | /* Trace the data. */ |
| 2081 | - if (toggled(DS_TRACE)) { | 2101 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_DS_TRACE)) { |
| 2082 | int i; | 2102 | int i; |
| 2083 | 2103 | ||
| 2084 | trace_dsn(">"); | 2104 | trace_dsn(">"); |
| @@ -2114,7 +2134,7 @@ static void | @@ -2114,7 +2134,7 @@ static void | ||
| 2114 | net_cookedout(const char *buf, int len) | 2134 | net_cookedout(const char *buf, int len) |
| 2115 | { | 2135 | { |
| 2116 | #if defined(X3270_TRACE) /*[*/ | 2136 | #if defined(X3270_TRACE) /*[*/ |
| 2117 | - if (toggled(DS_TRACE)) { | 2137 | + if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_DS_TRACE)) { |
| 2118 | int i; | 2138 | int i; |
| 2119 | 2139 | ||
| 2120 | trace_dsn(">"); | 2140 | trace_dsn(">"); |
| @@ -2147,9 +2167,9 @@ net_cookout(const char *buf, int len) | @@ -2147,9 +2167,9 @@ net_cookout(const char *buf, int len) | ||
| 2147 | c = buf[i]; | 2167 | c = buf[i]; |
| 2148 | 2168 | ||
| 2149 | /* Input conversions. */ | 2169 | /* Input conversions. */ |
| 2150 | - if (!lnext && c == '\r' && appres.icrnl) | 2170 | + if (!lnext && c == '\r' && h3270.icrnl) |
| 2151 | c = '\n'; | 2171 | c = '\n'; |
| 2152 | - else if (!lnext && c == '\n' && appres.inlcr) | 2172 | + else if (!lnext && c == '\n' && h3270.inlcr) |
| 2153 | c = '\r'; | 2173 | c = '\r'; |
| 2154 | 2174 | ||
| 2155 | /* Backslashes. */ | 2175 | /* Backslashes. */ |
| @@ -2637,7 +2657,7 @@ void trace_netdata(char direction, unsigned const char *buf, int len) | @@ -2637,7 +2657,7 @@ void trace_netdata(char direction, unsigned const char *buf, int len) | ||
| 2637 | struct timeval ts; | 2657 | struct timeval ts; |
| 2638 | double tdiff; | 2658 | double tdiff; |
| 2639 | 2659 | ||
| 2640 | - if (!toggled(DS_TRACE)) | 2660 | + if (!lib3270_get_toggle(&h3270,LIB3270_TOGGLE_DS_TRACE)) |
| 2641 | return; | 2661 | return; |
| 2642 | (void) gettimeofday(&ts, (struct timezone *)NULL); | 2662 | (void) gettimeofday(&ts, (struct timezone *)NULL); |
| 2643 | if (IN_3270) { | 2663 | if (IN_3270) { |
toggle.h
| @@ -49,10 +49,10 @@ | @@ -49,10 +49,10 @@ | ||
| 49 | #define DS_TRACE LIB3270_TOGGLE_DS_TRACE | 49 | #define DS_TRACE LIB3270_TOGGLE_DS_TRACE |
| 50 | #define SCROLL_BAR LIB3270_TOGGLE_SCROLL_BAR | 50 | #define SCROLL_BAR LIB3270_TOGGLE_SCROLL_BAR |
| 51 | #define LINE_WRAP LIB3270_TOGGLE_LINE_WRAP | 51 | #define LINE_WRAP LIB3270_TOGGLE_LINE_WRAP |
| 52 | - #define BLANK_FILL LIB3270_TOGGLE_BLANK_FILL | 52 | +// #define BLANK_FILL LIB3270_TOGGLE_BLANK_FILL |
| 53 | #define SCREEN_TRACE LIB3270_TOGGLE_SCREEN_TRACE | 53 | #define SCREEN_TRACE LIB3270_TOGGLE_SCREEN_TRACE |
| 54 | #define EVENT_TRACE LIB3270_TOGGLE_EVENT_TRACE | 54 | #define EVENT_TRACE LIB3270_TOGGLE_EVENT_TRACE |
| 55 | - #define MARGINED_PASTE LIB3270_TOGGLE_MARGINED_PASTE | 55 | +// #define MARGINED_PASTE LIB3270_TOGGLE_MARGINED_PASTE |
| 56 | #define RECTANGLE_SELECT LIB3270_TOGGLE_RECTANGLE_SELECT | 56 | #define RECTANGLE_SELECT LIB3270_TOGGLE_RECTANGLE_SELECT |
| 57 | #define CROSSHAIR LIB3270_TOGGLE_CROSSHAIR | 57 | #define CROSSHAIR LIB3270_TOGGLE_CROSSHAIR |
| 58 | // #define VISIBLE_CONTROL LIB3270_TOGGLE_VISIBLE_CONTROL | 58 | // #define VISIBLE_CONTROL LIB3270_TOGGLE_VISIBLE_CONTROL |
trace_ds.c
| @@ -142,7 +142,7 @@ trace_ds_s(char *s, Boolean can_break) | @@ -142,7 +142,7 @@ trace_ds_s(char *s, Boolean can_break) | ||
| 142 | int len = strlen(s); | 142 | int len = strlen(s); |
| 143 | Boolean nl = False; | 143 | Boolean nl = False; |
| 144 | 144 | ||
| 145 | - if (!toggled(DS_TRACE) || !len) | 145 | + if (!lib3270_get_toggle(&h3270,DS_TRACE) || !len) |
| 146 | return; | 146 | return; |
| 147 | 147 | ||
| 148 | if (s && s[len-1] == '\n') { | 148 | if (s && s[len-1] == '\n') { |
| @@ -177,7 +177,7 @@ trace_ds(const char *fmt, ...) | @@ -177,7 +177,7 @@ trace_ds(const char *fmt, ...) | ||
| 177 | char tdsbuf[4096]; | 177 | char tdsbuf[4096]; |
| 178 | va_list args; | 178 | va_list args; |
| 179 | 179 | ||
| 180 | - if (!toggled(DS_TRACE)) | 180 | + if (!lib3270_get_toggle(&h3270,DS_TRACE)) |
| 181 | return; | 181 | return; |
| 182 | 182 | ||
| 183 | va_start(args, fmt); | 183 | va_start(args, fmt); |
| @@ -194,7 +194,7 @@ trace_ds_nb(const char *fmt, ...) | @@ -194,7 +194,7 @@ trace_ds_nb(const char *fmt, ...) | ||
| 194 | char tdsbuf[4096]; | 194 | char tdsbuf[4096]; |
| 195 | va_list args; | 195 | va_list args; |
| 196 | 196 | ||
| 197 | - if (!toggled(DS_TRACE)) | 197 | + if (!lib3270_get_toggle(&h3270,DS_TRACE)) |
| 198 | return; | 198 | return; |
| 199 | 199 | ||
| 200 | va_start(args, fmt); | 200 | va_start(args, fmt); |
| @@ -211,7 +211,7 @@ trace_event(const char *fmt, ...) | @@ -211,7 +211,7 @@ trace_event(const char *fmt, ...) | ||
| 211 | { | 211 | { |
| 212 | va_list args; | 212 | va_list args; |
| 213 | 213 | ||
| 214 | - if (!toggled(EVENT_TRACE)) | 214 | + if (!lib3270_get_toggle(&h3270,EVENT_TRACE)) |
| 215 | return; | 215 | return; |
| 216 | 216 | ||
| 217 | /* print out message */ | 217 | /* print out message */ |
| @@ -226,7 +226,7 @@ trace_dsn(const char *fmt, ...) | @@ -226,7 +226,7 @@ trace_dsn(const char *fmt, ...) | ||
| 226 | { | 226 | { |
| 227 | va_list args; | 227 | va_list args; |
| 228 | 228 | ||
| 229 | - if (!toggled(DS_TRACE)) | 229 | + if (!lib3270_get_toggle(&h3270,DS_TRACE)) |
| 230 | return; | 230 | return; |
| 231 | 231 | ||
| 232 | /* print out message */ | 232 | /* print out message */ |
| @@ -760,14 +760,14 @@ static void tracefile_off(void) | @@ -760,14 +760,14 @@ static void tracefile_off(void) | ||
| 760 | 760 | ||
| 761 | void toggle_dsTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt) | 761 | void toggle_dsTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE tt) |
| 762 | { | 762 | { |
| 763 | - if (toggled(DS_TRACE) && tracef == NULL) | 763 | + if (lib3270_get_toggle(&h3270,DS_TRACE) && tracef == NULL) |
| 764 | tracefile_on(DS_TRACE, tt); | 764 | tracefile_on(DS_TRACE, tt); |
| 765 | 765 | ||
| 766 | // If turning off trace and not still tracing events, close the trace file. | 766 | // If turning off trace and not still tracing events, close the trace file. |
| 767 | - else if (!toggled(DS_TRACE) && !toggled(EVENT_TRACE)) | 767 | + else if (!lib3270_get_toggle(&h3270,DS_TRACE) && !lib3270_get_toggle(&h3270,EVENT_TRACE)) |
| 768 | tracefile_off(); | 768 | tracefile_off(); |
| 769 | 769 | ||
| 770 | - if (toggled(DS_TRACE)) | 770 | + if (lib3270_get_toggle(&h3270,DS_TRACE)) |
| 771 | (void) gettimeofday(&ds_ts, (struct timezone *)NULL); | 771 | (void) gettimeofday(&ds_ts, (struct timezone *)NULL); |
| 772 | } | 772 | } |
| 773 | */ | 773 | */ |
| @@ -777,11 +777,11 @@ void toggle_eventTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_T | @@ -777,11 +777,11 @@ void toggle_eventTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_T | ||
| 777 | { | 777 | { |
| 778 | // If turning on event debug, and no trace file, open one. | 778 | // If turning on event debug, and no trace file, open one. |
| 779 | 779 | ||
| 780 | - if (toggled(EVENT_TRACE) && tracef == NULL) | 780 | + if (lib3270_get_toggle(&h3270,EVENT_TRACE) && tracef == NULL) |
| 781 | tracefile_on(EVENT_TRACE, tt); | 781 | tracefile_on(EVENT_TRACE, tt); |
| 782 | 782 | ||
| 783 | // If turning off event debug, and not tracing the data stream, close the trace file. | 783 | // If turning off event debug, and not tracing the data stream, close the trace file. |
| 784 | - else if (!toggled(EVENT_TRACE) && !toggled(DS_TRACE)) | 784 | + else if (!lib3270_get_toggle(&h3270,EVENT_TRACE) && !lib3270_get_toggle(&h3270,DS_TRACE)) |
| 785 | tracefile_off(); | 785 | tracefile_off(); |
| 786 | } | 786 | } |
| 787 | */ | 787 | */ |
| @@ -815,14 +815,14 @@ void trace_screen(void) | @@ -815,14 +815,14 @@ void trace_screen(void) | ||
| 815 | { | 815 | { |
| 816 | trace_skipping = False; | 816 | trace_skipping = False; |
| 817 | 817 | ||
| 818 | - if (!toggled(SCREEN_TRACE)) | 818 | + if (!lib3270_get_toggle(&h3270,SCREEN_TRACE)) |
| 819 | do_screentrace(); | 819 | do_screentrace(); |
| 820 | } | 820 | } |
| 821 | 821 | ||
| 822 | /* Called from ANSI emulation code to log a single character. */ | 822 | /* Called from ANSI emulation code to log a single character. */ |
| 823 | void trace_char(char c) | 823 | void trace_char(char c) |
| 824 | { | 824 | { |
| 825 | - if (toggled(SCREEN_TRACE)) | 825 | + if (lib3270_get_toggle(&h3270,SCREEN_TRACE)) |
| 826 | wtrace("%c",c); | 826 | wtrace("%c",c); |
| 827 | return; | 827 | return; |
| 828 | } | 828 | } |
| @@ -924,7 +924,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ | @@ -924,7 +924,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_ | ||
| 924 | char *tracefile_buf = NULL; | 924 | char *tracefile_buf = NULL; |
| 925 | char *tracefile; | 925 | char *tracefile; |
| 926 | 926 | ||
| 927 | - if (toggled(SCREEN_TRACE)) { | 927 | + if (lib3270_get_toggle(&h3270,SCREEN_TRACE)) { |
| 928 | if (appres.screentrace_file) | 928 | if (appres.screentrace_file) |
| 929 | tracefile = appres.screentrace_file; | 929 | tracefile = appres.screentrace_file; |
| 930 | else { | 930 | else { |