Commit 091ee6b8a3bbd7f8f2a7809df7c18feb5ea1aa94

Authored by Perry Werneck
1 parent 866a32b5

Fixing oversize.

src/core/linux/connect.c
... ... @@ -125,6 +125,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG
125 125  
126 126 static int background_connect(H3270 *hSession, void *host)
127 127 {
  128 +
128 129 struct addrinfo hints;
129 130 struct addrinfo * result = NULL;
130 131 struct addrinfo * rp = NULL;
... ... @@ -176,6 +177,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG
176 177 struct resolver host;
177 178 memset(&host,0,sizeof(host));
178 179  
  180 + // Connect to host
179 181 if(lib3270_run_task(hSession, background_connect, &host) || hSession->sock < 0)
180 182 {
181 183 char buffer[4096];
... ...
src/core/model.c
... ... @@ -221,14 +221,6 @@ int lib3270_set_model(H3270 *hSession, const char *model)
221 221  
222 222 trace("Model_number: %d",model_number);
223 223  
224   - if (hSession->termname != CN)
225   - hSession->termtype = hSession->termname;
226   - else
227   - hSession->termtype = hSession->full_model_name;
228   -
229   - trace("Termtype: %s",hSession->termtype);
230   -
231   -
232 224 // Check for oversize
233 225 char junk;
234 226 int ovc, ovr;
... ...
src/core/properties/string.c
... ... @@ -44,6 +44,16 @@
44 44 return lib3270_get_revision();
45 45 }
46 46  
  47 + static const char * lib3270_get_termtype(const H3270 *hSession)
  48 + {
  49 + return hSession->termtype;
  50 + }
  51 +
  52 + static const char * lib3270_get_termname(const H3270 *hSession)
  53 + {
  54 + return hSession->termname;
  55 + }
  56 +
47 57 LIB3270_EXPORT const LIB3270_STRING_PROPERTY * lib3270_get_string_properties_list(void)
48 58 {
49 59 static const LIB3270_STRING_PROPERTY properties[] = {
... ... @@ -70,13 +80,27 @@
70 80 },
71 81  
72 82 {
73   - "host_type", // Property name.
  83 + "hosttype", // Property name.
74 84 N_( "Host type name" ), // Property description.
75 85 lib3270_get_host_type_name, // Get value.
76 86 lib3270_set_host_type_by_name // Set value.
77 87 },
78 88  
79 89 {
  90 + "termtype", // Property name.
  91 + N_( "Terminal type" ), // Property description.
  92 + lib3270_get_termtype, // Get value.
  93 + NULL // Set value.
  94 + },
  95 +
  96 + {
  97 + "termname", // Property name.
  98 + N_( "Terminal name" ), // Property description.
  99 + lib3270_get_termname, // Get value.
  100 + NULL // Set value.
  101 + },
  102 +
  103 + {
80 104 "host_charset", // Property name.
81 105 N_( "Host charset" ), // Property description.
82 106 lib3270_get_host_charset, // Get value.
... ...
src/core/screen.c
... ... @@ -276,20 +276,28 @@ LIB3270_EXPORT unsigned int lib3270_get_max_height(const H3270 *h)
276 276 return h->max.rows;
277 277 }
278 278  
279   -void update_model_info(H3270 *session, unsigned int model, unsigned int cols, unsigned int rows)
  279 +void update_model_info(H3270 *hSession, unsigned int model, unsigned int cols, unsigned int rows)
280 280 {
281   - if(model == session->model_num && session->max.rows == rows && session->max.cols == cols)
  281 + if(model == hSession->model_num && hSession->max.rows == rows && hSession->max.cols == cols)
282 282 return;
283 283  
284   - session->max.cols = cols;
285   - session->max.rows = rows;
286   - session->model_num = model;
  284 + hSession->max.cols = cols;
  285 + hSession->max.rows = rows;
  286 + hSession->model_num = model;
287 287  
288 288 /* Update the model name. */
289   - (void) sprintf(session->model_name, "327%c-%d%s",session->m3279 ? '9' : '8',session->model_num,session->extended ? "-E" : "");
  289 + (void) sprintf(hSession->model_name, "327%c-%d%s",hSession->m3279 ? '9' : '8',hSession->model_num,hSession->extended ? "-E" : "");
290 290  
291   - trace("%s: %p",__FUNCTION__,session->cbk.update_model);
292   - session->cbk.update_model(session, session->model_name,session->model_num,rows,cols);
  291 + if (hSession->termname != CN)
  292 + hSession->termtype = hSession->termname;
  293 + else if(hSession->oversize.rows || hSession->oversize.cols)
  294 + hSession->termtype = "IBM-DYNAMIC";
  295 + else
  296 + hSession->termtype = hSession->full_model_name;
  297 +
  298 + trace("Termtype: %s",hSession->termtype);
  299 +
  300 + hSession->cbk.update_model(hSession, hSession->model_name,hSession->model_num,rows,cols);
293 301 }
294 302  
295 303 LIB3270_EXPORT int lib3270_get_contents(H3270 *h, int first, int last, unsigned char *chr, unsigned short *attr)
... ...
src/core/telnet.c
... ... @@ -566,8 +566,10 @@ void net_disconnect(H3270 *session)
566 566 trace_dsn(session,"SENT disconnect\n");
567 567  
568 568 /* Restore terminal type to its default. */
  569 + /*
569 570 if (session->termname == CN)
570 571 session->termtype = session->full_model_name;
  572 + */
571 573  
572 574 /* We're not connected to an LU any more. */
573 575 session->connected_lu = CN;
... ... @@ -1193,11 +1195,16 @@ static void tn3270e_request(H3270 *hSession)
1193 1195  
1194 1196 net_rawout(hSession, (unsigned char *)tt_out, tb_len);
1195 1197  
1196   - trace_dsn(hSession,"SENT %s %s DEVICE-TYPE REQUEST %.*s%s%s %s\n",
1197   - cmd(SB), opt(TELOPT_TN3270E), (int) strlen(hSession->termtype), tt_out + 5,
1198   - (hSession->try_lu != CN && *hSession->try_lu) ? " CONNECT " : "",
1199   - (hSession->try_lu != CN && *hSession->try_lu) ? hSession->try_lu : "",
1200   - cmd(SE));
  1198 + trace_dsn(
  1199 + hSession,"SENT %s %s DEVICE-TYPE REQUEST %.*s%s%s %s\n",
  1200 + cmd(SB),
  1201 + opt(TELOPT_TN3270E),
  1202 + (int) strlen(hSession->termtype),
  1203 + tt_out + 5,
  1204 + (hSession->try_lu != CN && *hSession->try_lu) ? " CONNECT " : "",
  1205 + (hSession->try_lu != CN && *hSession->try_lu) ? hSession->try_lu : "",
  1206 + cmd(SE)
  1207 + );
1201 1208  
1202 1209 lib3270_free(tt_out);
1203 1210 }
... ...
src/include/telnetc.h
... ... @@ -41,7 +41,7 @@ LIB3270_INTERNAL void net_abort(H3270 *hSession);
41 41 LIB3270_INTERNAL void net_add_eor(unsigned char *buf, int len);
42 42 LIB3270_INTERNAL void net_break(H3270 *hSession);
43 43  
44   -LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *);
  44 +// LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *);
45 45 LIB3270_INTERNAL int net_reconnect(H3270 *hSession, int seconds);
46 46  
47 47 LIB3270_INTERNAL void net_disconnect(H3270 *session);
... ...