Commit a28c5fbfd1046dc97a6147d39014d3e5a03eddbe
1 parent
f5e385b3
Exists in
master
and in
3 other branches
Ajustes para flexibilizar configuração do tipo de terminal
Showing
2 changed files
with
64 additions
and
55 deletions
Show diff stats
session.c
| @@ -177,11 +177,71 @@ static void nop_int(H3270 *session, int width) | @@ -177,11 +177,71 @@ static void nop_int(H3270 *session, int width) | ||
| 177 | return; | 177 | return; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | -static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset) | 180 | +int lib3270_set_model_name(H3270 *hSession, const char *model) |
| 181 | { | 181 | { |
| 182 | int ovc, ovr; | 182 | int ovc, ovr; |
| 183 | char junk; | 183 | char junk; |
| 184 | int model_number; | 184 | int model_number; |
| 185 | + | ||
| 186 | + if(hSession->cstate != LIB3270_NOT_CONNECTED) | ||
| 187 | + return EBUSY; | ||
| 188 | + | ||
| 189 | + strncpy(hSession->full_model_name,"IBM-",LIB3270_FULL_MODEL_NAME_LENGTH); | ||
| 190 | + hSession->model_name = &hSession->full_model_name[4]; | ||
| 191 | + | ||
| 192 | + if(!*model) | ||
| 193 | + model = "2"; // No model, use the default one | ||
| 194 | + | ||
| 195 | + model_number = parse_model_number(hSession,model); | ||
| 196 | + if (model_number < 0) | ||
| 197 | + { | ||
| 198 | + popup_an_error(hSession,"Invalid model number: %s", model); | ||
| 199 | + model_number = 0; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + if (!model_number) | ||
| 203 | + { | ||
| 204 | +#if defined(RESTRICT_3279) | ||
| 205 | + model_number = 3; | ||
| 206 | +#else | ||
| 207 | + model_number = 4; | ||
| 208 | +#endif | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + if(hSession->mono) | ||
| 212 | + hSession->m3279 = 0; | ||
| 213 | + else | ||
| 214 | + hSession->m3279 = 1; | ||
| 215 | + | ||
| 216 | + if(!hSession->extended) | ||
| 217 | + hSession->oversize = CN; | ||
| 218 | + | ||
| 219 | +#if defined(RESTRICT_3279) | ||
| 220 | + if (hSession->m3279 && model_number == 4) | ||
| 221 | + model_number = 3; | ||
| 222 | +#endif | ||
| 223 | + | ||
| 224 | + trace("Model_number: %d",model_number); | ||
| 225 | + | ||
| 226 | + if (!hSession->extended || hSession->oversize == CN || sscanf(hSession->oversize, "%dx%d%c", &ovc, &ovr, &junk) != 2) | ||
| 227 | + { | ||
| 228 | + ovc = 0; | ||
| 229 | + ovr = 0; | ||
| 230 | + } | ||
| 231 | + ctlr_set_rows_cols(hSession, model_number, ovc, ovr); | ||
| 232 | + | ||
| 233 | + if (hSession->termname != CN) | ||
| 234 | + hSession->termtype = hSession->termname; | ||
| 235 | + else | ||
| 236 | + hSession->termtype = hSession->full_model_name; | ||
| 237 | + | ||
| 238 | + trace("Termtype: %s",hSession->termtype); | ||
| 239 | + | ||
| 240 | + return 0; | ||
| 241 | +} | ||
| 242 | + | ||
| 243 | +static void lib3270_session_init(H3270 *hSession, const char *model, const char *charset) | ||
| 244 | +{ | ||
| 185 | int f; | 245 | int f; |
| 186 | 246 | ||
| 187 | memset(hSession,0,sizeof(H3270)); | 247 | memset(hSession,0,sizeof(H3270)); |
| @@ -248,59 +308,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char | @@ -248,59 +308,7 @@ static void lib3270_session_init(H3270 *hSession, const char *model, const char | ||
| 248 | // Initialize toggles | 308 | // Initialize toggles |
| 249 | initialize_toggles(hSession); | 309 | initialize_toggles(hSession); |
| 250 | 310 | ||
| 251 | - strncpy(hSession->full_model_name,"IBM-",LIB3270_FULL_MODEL_NAME_LENGTH); | ||
| 252 | - hSession->model_name = &hSession->full_model_name[4]; | ||
| 253 | - | ||
| 254 | - if(!*model) | ||
| 255 | - model = "2"; // No model, use the default one | ||
| 256 | - | ||
| 257 | - model_number = parse_model_number(hSession,model); | ||
| 258 | - if (model_number < 0) | ||
| 259 | - { | ||
| 260 | - popup_an_error(hSession,"Invalid model number: %s", model); | ||
| 261 | - model_number = 0; | ||
| 262 | - } | ||
| 263 | - | ||
| 264 | - if (!model_number) | ||
| 265 | - { | ||
| 266 | -#if defined(RESTRICT_3279) | ||
| 267 | - model_number = 3; | ||
| 268 | -#else | ||
| 269 | - model_number = 4; | ||
| 270 | -#endif | ||
| 271 | - } | ||
| 272 | - | ||
| 273 | - if(hSession->mono) | ||
| 274 | - hSession->m3279 = 0; | ||
| 275 | - else | ||
| 276 | - hSession->m3279 = 1; | ||
| 277 | - | ||
| 278 | - if(!hSession->extended) | ||
| 279 | - hSession->oversize = CN; | ||
| 280 | - | ||
| 281 | -#if defined(RESTRICT_3279) | ||
| 282 | - if (hSession->m3279 && model_number == 4) | ||
| 283 | - model_number = 3; | ||
| 284 | -#endif | ||
| 285 | - | ||
| 286 | - trace("Model_number: %d",model_number); | ||
| 287 | - | ||
| 288 | - if (!hSession->extended || hSession->oversize == CN || sscanf(hSession->oversize, "%dx%d%c", &ovc, &ovr, &junk) != 2) | ||
| 289 | - { | ||
| 290 | - ovc = 0; | ||
| 291 | - ovr = 0; | ||
| 292 | - } | ||
| 293 | - ctlr_set_rows_cols(hSession, model_number, ovc, ovr); | ||
| 294 | - | ||
| 295 | - if (hSession->termname != CN) | ||
| 296 | - hSession->termtype = hSession->termname; | ||
| 297 | - else | ||
| 298 | - hSession->termtype = hSession->full_model_name; | ||
| 299 | - | ||
| 300 | - trace("Termtype: %s",hSession->termtype); | ||
| 301 | - | ||
| 302 | -// if (hSession->apl_mode) | ||
| 303 | -// hSession->charset.host = "apl"; | 311 | + lib3270_set_model_name(hSession,model); |
| 304 | 312 | ||
| 305 | } | 313 | } |
| 306 | 314 |
telnet.c
| @@ -684,12 +684,13 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -684,12 +684,13 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
| 684 | 684 | ||
| 685 | } | 685 | } |
| 686 | 686 | ||
| 687 | - /* set up temporary termtype */ | 687 | + /* set up temporary termtype |
| 688 | if (session->termname == CN && session->std_ds_host) | 688 | if (session->termname == CN && session->std_ds_host) |
| 689 | { | 689 | { |
| 690 | sprintf(session->ttype_tmpval, "IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num); | 690 | sprintf(session->ttype_tmpval, "IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num); |
| 691 | session->termtype = session->ttype_tmpval; | 691 | session->termtype = session->ttype_tmpval; |
| 692 | } | 692 | } |
| 693 | + */ | ||
| 693 | 694 | ||
| 694 | /* all done */ | 695 | /* all done */ |
| 695 | #if defined(_WIN32) | 696 | #if defined(_WIN32) |