diff --git a/latest/src/gtk2/mouse.c b/latest/src/gtk2/mouse.c index 13307d1..f65410c 100644 --- a/latest/src/gtk2/mouse.c +++ b/latest/src/gtk2/mouse.c @@ -151,7 +151,7 @@ { int ret = 0; - if( !(*screen->content[baddr+1].ch == 'F' && FA_IS_PROTECTED(get_field_attribute(baddr))) ) + if( !(*screen->content[baddr+1].ch == 'F' && FA_IS_PROTECTED(get_field_attribute(NULL,baddr))) ) return ret; baddr++; @@ -220,8 +220,8 @@ { if(valid_terminal_window()) { - int baddr = find_field_attribute(cursor_position); - int length = find_field_length(baddr); + int baddr = find_field_attribute(NULL,cursor_position); + int length = find_field_length(NULL,baddr); SetSelection(FALSE); diff --git a/latest/src/gtk2/screen.c b/latest/src/gtk2/screen.c index 1ec14b8..fe7f458 100644 --- a/latest/src/gtk2/screen.c +++ b/latest/src/gtk2/screen.c @@ -62,7 +62,7 @@ /*---[ Prototipes ]----------------------------------------------------------------------------------------*/ - static int addch(int row, int col, int c, unsigned short attr); + static int addch(int row, int col, unsigned char c, unsigned short attr); static void set_charset(char *dcs); static void erase(void); @@ -104,7 +104,7 @@ model_changed, // void (*model_changed)(H3270 *session, const char *name, int model, int cols, int rows); - addch, // void (*addch)(int row, int col, int c, int attr); + addch, // void (*addch)(int row, int col, unsigned char c, int attr); set_charset, // void (*charset)(char *dcs); settitle, // void (*title)(char *text); gdk_beep, // void (*ring_bell)(void); @@ -272,7 +272,7 @@ } - static int addch(int row, int col, int c, unsigned short attr) + static int addch(int row, int col, unsigned char c, unsigned short attr) { int baddr = (row*screen->cols)+col; diff --git a/latest/src/include/lib3270.h b/latest/src/include/lib3270.h index 1f3e4d9..6f7ea7d 100644 --- a/latest/src/include/lib3270.h +++ b/latest/src/include/lib3270.h @@ -179,7 +179,10 @@ LIB3270_EXPORT int lib3270_get_cursor_address(H3270 *h); - LIB3270_EXPORT STATUS_CODE lib3270_get_oia_status(H3270 *h); + LIB3270_EXPORT STATUS_CODE lib3270_get_oia_status(H3270 *h); + LIB3270_EXPORT const char * lib3270_get_luname(H3270 *h); + LIB3270_EXPORT const char * lib3270_get_host(H3270 *h); + #endif // LIB3270_H_INCLUDED diff --git a/latest/src/include/lib3270/api.h b/latest/src/include/lib3270/api.h index c94b944..0c188dd 100644 --- a/latest/src/include/lib3270/api.h +++ b/latest/src/include/lib3270/api.h @@ -222,8 +222,8 @@ // screen info int ov_rows; int ov_cols; - int first_changed; - int last_changed; +// int first_changed; +// int last_changed; int maxROWS; int maxCOLS; int rows; @@ -235,6 +235,14 @@ int formatted; /**< set in screen_disp */ + // host.c + char std_ds_host; + char no_login_host; + char non_tn3270e_host; + char passthru_host; + char ssl_host; + char ever_3270; + // Widget info void * widget; @@ -279,14 +287,19 @@ /** extended attributes */ struct ea { - unsigned char cc; /**< EBCDIC or ASCII character code */ - unsigned char fa; /**< field attribute, it nonzero */ - unsigned char fg; /**< foreground color (0x00 or 0xf) */ - unsigned char bg; /**< background color (0x00 or 0xf) */ - unsigned char gr; /**< ANSI graphics rendition bits */ - unsigned char cs; /**< character set (GE flag, or 0..2) */ - unsigned char ic; /**< input control (DBCS) */ - unsigned char db; /**< DBCS state */ + unsigned char cc; /**< EBCDIC or ASCII character code */ + unsigned char fa; /**< field attribute, it nonzero */ + unsigned char fg; /**< foreground color (0x00 or 0xf) */ + unsigned char bg; /**< background color (0x00 or 0xf) */ + unsigned char gr; /**< ANSI graphics rendition bits */ + unsigned char cs; /**< character set (GE flag, or 0..2) */ + unsigned char ic; /**< input control (DBCS) */ + unsigned char db; /**< DBCS state */ + + /* Updated by addch() */ + unsigned char chr; /**< ASCII character code */ + unsigned short attr; /**< Converted character attribute (color & etc) */ + }; #define GR_BLINK 0x01 #define GR_REVERSE 0x02 @@ -466,7 +479,7 @@ void (*Warning)(const char *fmt, va_list arg); void (*SysError)(const char *title, const char *message, const char *system); void (*model_changed)(H3270 *session, const char *name, int model, int cols, int rows); - int (*addch)(int row, int col, int c, unsigned short attr); + int (*addch)(int row, int col, unsigned char c, unsigned short attr); void (*charset)(char *dcs); void (*title)(char *text); void (*ring_bell)(void); @@ -554,8 +567,8 @@ LIB3270_EXPORT int get_3270_model(H3270 *session); /* Get connection info */ - LIB3270_EXPORT const char * get_connected_lu(H3270 *h); - LIB3270_EXPORT const char * get_current_host(H3270 *h); + #define get_connected_lu(h) lib3270_get_luname(h) + #define get_current_host(h) lib3270_get_host(h) LIB3270_EXPORT SCRIPT_STATE status_script(SCRIPT_STATE state); diff --git a/latest/src/lib/ctlr.c b/latest/src/lib/ctlr.c index 54c5c5b..85b1e63 100644 --- a/latest/src/lib/ctlr.c +++ b/latest/src/lib/ctlr.c @@ -296,7 +296,7 @@ static void ctlr_connect(H3270 *session, int ignored unused, void *dunno) ticking_stop(session); status_untiming(session); - if (ever_3270) + if (session->ever_3270) ea_buf[-1].fa = FA_PRINTABLE | FA_MODIFY; else ea_buf[-1].fa = FA_PRINTABLE | FA_PROTECT; @@ -2618,6 +2618,7 @@ void ctlr_scroll(void) */ void changed(H3270 *session, int bstart, int bend) { + /* if(session->first_changed < 0) { session->first_changed = bstart; @@ -2629,7 +2630,7 @@ void changed(H3270 *session, int bstart, int bend) if(bend > session->last_changed) session->last_changed = bend; - + */ } /* diff --git a/latest/src/lib/globals.h b/latest/src/lib/globals.h index 64a5e34..f119bb1 100644 --- a/latest/src/lib/globals.h +++ b/latest/src/lib/globals.h @@ -209,8 +209,8 @@ LIB3270_INTERNAL char *hostname; // LIB3270_INTERNAL int model_num; LIB3270_INTERNAL Boolean no_login_host; LIB3270_INTERNAL Boolean non_tn3270e_host; -LIB3270_INTERNAL int ov_cols, ov_rows; -LIB3270_INTERNAL Boolean passthru_host; +// LIB3270_INTERNAL int ov_cols, ov_rows; + LIB3270_INTERNAL Boolean passthru_host; LIB3270_INTERNAL const char *programname; LIB3270_INTERNAL char *qualified_host; LIB3270_INTERNAL char *reconnect_host; diff --git a/latest/src/lib/glue.c b/latest/src/lib/glue.c index a359c9a..212b582 100644 --- a/latest/src/lib/glue.c +++ b/latest/src/lib/glue.c @@ -167,8 +167,8 @@ H3270 * lib3270_session_new(const char *model) hSession->sz = sizeof(H3270); hSession->sock = -1; hSession->model_num = -1; - hSession->first_changed = -1; - hSession->last_changed = -1; +// hSession->first_changed = -1; +// hSession->last_changed = -1; hSession->cstate = NOT_CONNECTED; hSession->oia_status = -1; @@ -255,8 +255,8 @@ H3270 * lib3270_session_new(const char *model) return NULL; kybd_init(); - hostfile_init(); - hostfile_init(); +// hostfile_init(); +// hostfile_init(); ansi_init(); #if defined(X3270_FT) diff --git a/latest/src/lib/host.c b/latest/src/lib/host.c index 0b958b7..41e823a 100644 --- a/latest/src/lib/host.c +++ b/latest/src/lib/host.c @@ -57,23 +57,23 @@ #define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */ #define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */ -#define MAX_RECENT 5 +// #define MAX_RECENT 5 // enum cstate cstate = NOT_CONNECTED; -Boolean std_ds_host = False; -Boolean no_login_host = False; -Boolean non_tn3270e_host = False; -Boolean passthru_host = False; -Boolean ssl_host = False; -Boolean ever_3270 = False; +// Boolean std_ds_host = False; +// Boolean no_login_host = False; +// Boolean non_tn3270e_host = False; +// Boolean passthru_host = False; +// Boolean ssl_host = False; +// Boolean ever_3270 = False; // char *full_current_host = CN; //unsigned short current_port; //char *reconnect_host = CN; //char *qualified_host = CN; -struct host *hosts = (struct host *)NULL; -static struct host *last_host = (struct host *)NULL; +// struct host *hosts = (struct host *)NULL; +// static struct host *last_host = (struct host *)NULL; // static Boolean auto_reconnect_inprogress = False; // static int net_sock = -1; @@ -105,7 +105,7 @@ static char * stoken(char **s) /* * Read the host file - */ + */ /* void hostfile_init(void) { @@ -155,10 +155,10 @@ hostfile_init(void) } h->hostname = NewString(hostname); - /* - * Quick syntax extension to allow the hosts file to - * specify a port as host/port. - */ + // + // Quick syntax extension to allow the hosts file to + // specify a port as host/port. + // if ((slash = strchr(h->hostname, '/'))) *slash = ':'; @@ -187,13 +187,14 @@ hostfile_init(void) // #if defined(X3270_DISPLAY) // save_recent(CN); -// #endif /*]*/ +// #endif } +*/ /* * Look up a host in the list. Turns aliases into real hostnames, and * finds loginstrings. - */ + */ /* static int hostfile_lookup(const char *name, char **hostname, char **loginstring) { @@ -215,6 +216,7 @@ hostfile_lookup(const char *name, char **hostname, char **loginstring) } return 0; } +*/ #if defined(LOCAL_PROCESS) /*[*/ /* Recognize and translate "-e" options. */ @@ -247,14 +249,14 @@ parse_localprocess(const char *s) * Returns NULL if there is a syntax error. */ static char * -split_host(char *s, Boolean *ansi, Boolean *std_ds, Boolean *passthru, - Boolean *non_e, Boolean *secure, Boolean *no_login, char *xluname, - char **port, Boolean *needed) +split_host(char *s, char *ansi, char *std_ds, char *passthru, + char *non_e, char *secure, char *no_login, char *xluname, + char **port, char *needed) { char *lbracket = CN; char *at = CN; char *r = NULL; - Boolean colon = False; + char colon = False; *ansi = False; *std_ds = False; @@ -486,7 +488,7 @@ split_success: static int do_connect(H3270 *hSession, const char *n) { char nb[2048]; /* name buffer */ - char *s; /* temporary */ + char *s; /* temporary */ const char *chost; /* to whom we will connect */ char *target_name; char *ps = CN; @@ -534,26 +536,26 @@ static int do_connect(H3270 *hSession, const char *n) Boolean needed; /* Strip off and remember leading qualifiers. */ - if ((s = split_host(nb, &ansi_host, &std_ds_host, - &passthru_host, &non_tn3270e_host, &ssl_host, - &no_login_host, hSession->luname, &port, + if ((s = split_host(nb, &ansi_host, &hSession->std_ds_host, + &hSession->passthru_host, &hSession->non_tn3270e_host, &hSession->ssl_host, + &hSession->no_login_host, hSession->luname, &port, &needed)) == CN) return -1; - /* Look up the name in the hosts file. */ + /* Look up the name in the hosts file. */ /* if (!needed && hostfile_lookup(s, &target_name, &ps)) { - /* - * Rescan for qualifiers. - * Qualifiers, LU names, and ports are all overridden - * by the hosts file. - */ + // + // Rescan for qualifiers. + // Qualifiers, LU names, and ports are all overridden + // by the hosts file. + // Free(s); if (!(s = split_host(target_name, &ansi_host, &std_ds_host, &passthru_host, &non_tn3270e_host, &ssl_host, &no_login_host, hSession->luname, &port, &needed))) return -1; - } + } */ chost = s; /* Default the port. */ @@ -588,7 +590,7 @@ static int do_connect(H3270 *hSession, const char *n) Replace(hSession->qualified_host, xs_buffer("%s%s%s%s:%s", - ssl_host? "L:": "", + hSession->ssl_host? "L:": "", has_colons? "[": "", chost, has_colons? "]": "", @@ -596,7 +598,7 @@ static int do_connect(H3270 *hSession, const char *n) /* Attempt contact. */ - ever_3270 = False; + hSession->ever_3270 = False; hSession->net_sock = net_connect(chost, port, localprocess_cmd != CN, &resolving,&pending); if (hSession->net_sock < 0 && !resolving) @@ -689,8 +691,7 @@ static void try_reconnect(H3270 *session) void host_disconnect(H3270 *h, int failed) { - if(!h) - h = &h3270; + CHECK_SESSION_HANDLE(h); if (CONNECTED || HALF_CONNECTED) { @@ -731,7 +732,7 @@ host_in3270(enum cstate new_cstate) new_cstate == CONNECTED_TN3270E); h3270.cstate = new_cstate; - ever_3270 = now3270; + h3270.ever_3270 = now3270; st_changed(ST_3270_MODE, now3270); } @@ -747,8 +748,9 @@ host_connected(void) #endif /*]*/ } -#if defined(X3270_DISPLAY) /*[*/ -/* Comparison function for the qsort. */ +/* +#if defined(X3270_DISPLAY) +// Comparison function for the qsort. static int host_compare(const void *e1, const void *e2) { @@ -762,17 +764,18 @@ host_compare(const void *e1, const void *e2) r = 1; else r = 0; -#if defined(CFDEBUG) /*[*/ +#if defined(CFDEBUG) printf("%s %ld %d %s %ld\n", h1->name, h1->connect_time, r, h2->name, h2->connect_time); -#endif /*]*/ +#endif return r; } -#endif /*]*/ +#endif + -#if defined(CFDEBUG) /*[*/ +#if defined(CFDEBUG) static void dump_array(const char *when, struct host **array, int nh) { @@ -783,9 +786,9 @@ dump_array(const char *when, struct host **array, int nh) printf(" %15s %ld\n", array[i]->name, array[i]->connect_time); } } -#endif /*]*/ +#endif + -/* #if defined(X3270_DISPLAY) static void save_recent(const char *hn) @@ -1039,16 +1042,14 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *h,int wait) return 0; } -LIB3270_EXPORT const char * get_connected_lu(H3270 *h) +LIB3270_EXPORT const char * lib3270_get_luname(H3270 *h) { - if(h) - return h->connected_lu; - return h3270.connected_lu; + CHECK_SESSION_HANDLE(h); + return h->connected_lu; } -LIB3270_EXPORT const char * get_current_host(H3270 *h) +LIB3270_EXPORT const char * lib3270_get_host(H3270 *h) { - if(h) - return h->current_host; - return h3270.current_host; + CHECK_SESSION_HANDLE(h); + return h->current_host; } diff --git a/latest/src/lib/screen.c b/latest/src/lib/screen.c index ec1429c..71a3068 100644 --- a/latest/src/lib/screen.c +++ b/latest/src/lib/screen.c @@ -99,16 +99,15 @@ void set_display_charset(char *dcs) callbacks->charset(dcs); } -/* -static void addch(int row, int col, int c, int attr) +static void addch(H3270 *session, int baddr, unsigned char c, unsigned short attr) { - if(callbacks && callbacks->addch) - callbacks->addch(row, col, c, attr); -} -*/ + if(ea_buf[baddr].chr == c && ea_buf[baddr].attr == attr) + return; + + /* Converted char has changed, update it */ + ea_buf[baddr].chr = c; + ea_buf[baddr].attr = attr; -static void addch(H3270 *session, int baddr, unsigned short c, int attr) -{ if(callbacks && callbacks->addch) callbacks->addch(baddr/session->cols, baddr%session->cols, c, attr); } @@ -181,15 +180,6 @@ static unsigned short color_from_fa(unsigned char fa) } /* -static int reverse_colors(int a) -{ - int bg = (a & 0xF0) >> 4; - int fg = (a & 0x0F); - return get_color_pair(bg,fg) | (a&0xFF00); -} -*/ - -/* * Find the display attributes for a baddr, fa_addr and fa. */ static unsigned short calc_attrs(int baddr, int fa_addr, int fa) @@ -405,8 +395,8 @@ static void screen_update(H3270 *session, int bstart, int bend) void screen_disp(H3270 *session) { - session->first_changed = -1; - session->last_changed = -1; +// session->first_changed = -1; +// session->last_changed = -1; screen_update(session,0,session->rows*session->cols); diff --git a/latest/src/lib/telnet.c b/latest/src/lib/telnet.c index e84d8a3..2091287 100644 --- a/latest/src/lib/telnet.c +++ b/latest/src/lib/telnet.c @@ -464,7 +464,7 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving Replace(h3270.hostname, NewString(host)); /* get the passthru host and port number */ - if (passthru_host) { + if (h3270.passthru_host) { const char *hn; hn = getenv("INTERNET_HOST"); @@ -509,7 +509,7 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving /* fill in the socket address of the given host */ (void) memset((char *) &haddr, 0, sizeof(haddr)); - if (passthru_host) { + if (h3270.passthru_host) { haddr.sin.sin_family = AF_INET; (void) memmove(&haddr.sin.sin_addr, passthru_haddr, passthru_len); @@ -632,7 +632,7 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving /* init ssl */ #if defined(HAVE_LIBSSL) /*[*/ last_ssl_error = 0; - if (ssl_host) + if (h3270.ssl_host) ssl_init(); #endif /*]*/ @@ -663,7 +663,7 @@ int net_connect(const char *host, char *portname, Boolean ls, Boolean *resolving #endif /*]*/ /* set up temporary termtype */ - if (appres.termname == CN && std_ds_host) { + if (appres.termname == CN && h3270.std_ds_host) { (void) sprintf(ttype_tmpval, "IBM-327%c-%d", appres.m3279 ? '9' : '8', h3270.model_num); h3270.termtype = ttype_tmpval; @@ -768,11 +768,11 @@ net_connected(void) } } - trace_dsn("Connected to %s, port %u%s.\n", h3270.hostname, h3270.current_port,ssl_host? " via SSL": ""); + trace_dsn("Connected to %s, port %u%s.\n", h3270.hostname, h3270.current_port,h3270.ssl_host? " via SSL": ""); #if defined(HAVE_LIBSSL) /*[*/ /* Set up SSL. */ - if (ssl_host && !h3270.secure_connection) { + if (h3270.ssl_host && !h3270.secure_connection) { if (SSL_set_fd(ssl_con, h3270.sock) != 1) { trace_dsn("Can't set fd!\n"); } @@ -827,7 +827,7 @@ net_connected(void) check_linemode(True); /* write out the passthru hostname and port nubmer */ - if (passthru_host) { + if (h3270.passthru_host) { char *buf; buf = Malloc(strlen(h3270.hostname) + 32); @@ -1287,7 +1287,7 @@ telnet_fsm(unsigned char c) #if defined(X3270_TN3270E) /*[*/ case TELOPT_TN3270E: #endif /*]*/ - if (c != TELOPT_TN3270E || !non_tn3270e_host) { + if (c != TELOPT_TN3270E || !h3270.non_tn3270e_host) { if (!hisopts[c]) { hisopts[c] = 1; do_opt[2] = c; @@ -1348,7 +1348,7 @@ telnet_fsm(unsigned char c) #if defined(HAVE_LIBSSL) /*[*/ case TELOPT_STARTTLS: #endif /*]*/ - if (c == TELOPT_TN3270E && non_tn3270e_host) + if (c == TELOPT_TN3270E && h3270.non_tn3270e_host) goto wont; if (c == TELOPT_TM && !appres.bsd_tm) goto wont; @@ -3203,7 +3203,7 @@ ssl_init(void) ssl_ctx = SSL_CTX_new(SSLv23_method()); if (ssl_ctx == NULL) { popup_an_error("SSL_CTX_new failed"); - ssl_host = False; + h3270.ssl_host = False; return; } SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL); @@ -3212,7 +3212,7 @@ ssl_init(void) ssl_con = SSL_new(ssl_ctx); if (ssl_con == NULL) { popup_an_error("SSL_new failed"); - ssl_host = False; + h3270.ssl_host = False; } SSL_set_verify(ssl_con, 0/*xxx*/, NULL); diff --git a/latest/src/plugins/rexx/screen.c b/latest/src/plugins/rexx/screen.c index f34c47e..248e92a 100644 --- a/latest/src/plugins/rexx/screen.c +++ b/latest/src/plugins/rexx/screen.c @@ -108,7 +108,7 @@ if(Argc != 1) return RXFUNC_BADCALL; - return RetValue(Retstr,find_field_attribute(atoi(Argv[0].strptr))); + return RetValue(Retstr,find_field_attribute(NULL,atoi(Argv[0].strptr))); } RexxReturnCode REXXENTRY rx3270FindFieldLength(PSZ Name, LONG Argc, RXSTRING Argv[],PSZ Queuename, PRXSTRING Retstr) @@ -116,7 +116,7 @@ if(Argc != 1) return RXFUNC_BADCALL; - return RetValue(Retstr,find_field_length(atoi(Argv[0].strptr))); + return RetValue(Retstr,find_field_length(NULL,atoi(Argv[0].strptr))); } /*----------------------------------------------------------------------------*/ -- libgit2 0.21.2