diff --git a/src/core/linux/connect.c b/src/core/linux/connect.c index 6c6b7d2..619191c 100644 --- a/src/core/linux/connect.c +++ b/src/core/linux/connect.c @@ -125,6 +125,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG static int background_connect(H3270 *hSession, void *host) { + struct addrinfo hints; struct addrinfo * result = NULL; struct addrinfo * rp = NULL; @@ -176,6 +177,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG struct resolver host; memset(&host,0,sizeof(host)); + // Connect to host if(lib3270_run_task(hSession, background_connect, &host) || hSession->sock < 0) { char buffer[4096]; diff --git a/src/core/model.c b/src/core/model.c index 292df33..ce5bdc2 100644 --- a/src/core/model.c +++ b/src/core/model.c @@ -221,14 +221,6 @@ int lib3270_set_model(H3270 *hSession, const char *model) trace("Model_number: %d",model_number); - if (hSession->termname != CN) - hSession->termtype = hSession->termname; - else - hSession->termtype = hSession->full_model_name; - - trace("Termtype: %s",hSession->termtype); - - // Check for oversize char junk; int ovc, ovr; diff --git a/src/core/properties/string.c b/src/core/properties/string.c index 57390d1..2ecbbef 100644 --- a/src/core/properties/string.c +++ b/src/core/properties/string.c @@ -44,6 +44,16 @@ return lib3270_get_revision(); } + static const char * lib3270_get_termtype(const H3270 *hSession) + { + return hSession->termtype; + } + + static const char * lib3270_get_termname(const H3270 *hSession) + { + return hSession->termname; + } + LIB3270_EXPORT const LIB3270_STRING_PROPERTY * lib3270_get_string_properties_list(void) { static const LIB3270_STRING_PROPERTY properties[] = { @@ -70,13 +80,27 @@ }, { - "host_type", // Property name. + "hosttype", // Property name. N_( "Host type name" ), // Property description. lib3270_get_host_type_name, // Get value. lib3270_set_host_type_by_name // Set value. }, { + "termtype", // Property name. + N_( "Terminal type" ), // Property description. + lib3270_get_termtype, // Get value. + NULL // Set value. + }, + + { + "termname", // Property name. + N_( "Terminal name" ), // Property description. + lib3270_get_termname, // Get value. + NULL // Set value. + }, + + { "host_charset", // Property name. N_( "Host charset" ), // Property description. lib3270_get_host_charset, // Get value. diff --git a/src/core/screen.c b/src/core/screen.c index 655525f..d004194 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -276,20 +276,28 @@ LIB3270_EXPORT unsigned int lib3270_get_max_height(const H3270 *h) return h->max.rows; } -void update_model_info(H3270 *session, unsigned int model, unsigned int cols, unsigned int rows) +void update_model_info(H3270 *hSession, unsigned int model, unsigned int cols, unsigned int rows) { - if(model == session->model_num && session->max.rows == rows && session->max.cols == cols) + if(model == hSession->model_num && hSession->max.rows == rows && hSession->max.cols == cols) return; - session->max.cols = cols; - session->max.rows = rows; - session->model_num = model; + hSession->max.cols = cols; + hSession->max.rows = rows; + hSession->model_num = model; /* Update the model name. */ - (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,session->extended ? "-E" : ""); + (void) sprintf(hSession->model_name, "327%c-%d%s",hSession->m3279 ? '9' : '8',hSession->model_num,hSession->extended ? "-E" : ""); - trace("%s: %p",__FUNCTION__,session->cbk.update_model); - session->cbk.update_model(session, session->model_name,session->model_num,rows,cols); + if (hSession->termname != CN) + hSession->termtype = hSession->termname; + else if(hSession->oversize.rows || hSession->oversize.cols) + hSession->termtype = "IBM-DYNAMIC"; + else + hSession->termtype = hSession->full_model_name; + + trace("Termtype: %s",hSession->termtype); + + hSession->cbk.update_model(hSession, hSession->model_name,hSession->model_num,rows,cols); } LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr) diff --git a/src/core/telnet.c b/src/core/telnet.c index 784d100..c20d7ca 100644 --- a/src/core/telnet.c +++ b/src/core/telnet.c @@ -566,8 +566,10 @@ void net_disconnect(H3270 *session) trace_dsn(session,"SENT disconnect\n"); /* Restore terminal type to its default. */ + /* if (session->termname == CN) session->termtype = session->full_model_name; + */ /* We're not connected to an LU any more. */ session->connected_lu = CN; @@ -1193,11 +1195,16 @@ static void tn3270e_request(H3270 *hSession) net_rawout(hSession, (unsigned char *)tt_out, tb_len); - trace_dsn(hSession,"SENT %s %s DEVICE-TYPE REQUEST %.*s%s%s %s\n", - cmd(SB), opt(TELOPT_TN3270E), (int) strlen(hSession->termtype), tt_out + 5, - (hSession->try_lu != CN && *hSession->try_lu) ? " CONNECT " : "", - (hSession->try_lu != CN && *hSession->try_lu) ? hSession->try_lu : "", - cmd(SE)); + trace_dsn( + hSession,"SENT %s %s DEVICE-TYPE REQUEST %.*s%s%s %s\n", + cmd(SB), + opt(TELOPT_TN3270E), + (int) strlen(hSession->termtype), + tt_out + 5, + (hSession->try_lu != CN && *hSession->try_lu) ? " CONNECT " : "", + (hSession->try_lu != CN && *hSession->try_lu) ? hSession->try_lu : "", + cmd(SE) + ); lib3270_free(tt_out); } diff --git a/src/include/telnetc.h b/src/include/telnetc.h index fb14360..b649dbd 100644 --- a/src/include/telnetc.h +++ b/src/include/telnetc.h @@ -41,7 +41,7 @@ LIB3270_INTERNAL void net_abort(H3270 *hSession); LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len); LIB3270_INTERNAL void net_break(H3270 *hSession); -LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); +// LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); LIB3270_INTERNAL int net_reconnect(H3270 *hSession, int seconds); LIB3270_INTERNAL void net_disconnect(H3270 *session); -- libgit2 0.21.2