Commit 0b2a74c32c0c2cbd0d8ea054dd23d1dacf171939
1 parent
d6f4f92b
Exists in
master
and in
5 other branches
Incluindo opção para incluir o nome da LU na URL de conexão
Showing
3 changed files
with
34 additions
and
2 deletions
Show diff stats
src/include/lib3270/session.h
src/lib3270/host.c
| ... | ... | @@ -573,6 +573,39 @@ LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *n) |
| 573 | 573 | Replace(h->host.current,strdup(hostname)); |
| 574 | 574 | Replace(h->host.srvc,strdup(srvc)); |
| 575 | 575 | |
| 576 | + // Verifica parâmetros | |
| 577 | + if(query && *query) | |
| 578 | + { | |
| 579 | + char *str = strdup(query); | |
| 580 | + char *saveptr = NULL; | |
| 581 | + char *ptr; | |
| 582 | + | |
| 583 | + for(ptr = strtok_r(str,"&",&saveptr);ptr;ptr=strtok_r(NULL,"&",&saveptr)) | |
| 584 | + { | |
| 585 | + char *var = ptr; | |
| 586 | + char *val = strchr(ptr,'='); | |
| 587 | + if(val) | |
| 588 | + { | |
| 589 | + *(val++) = 0; | |
| 590 | + | |
| 591 | + if(!(strcasecmp(var,"lu") && strcasecmp(var,"luname"))) | |
| 592 | + { | |
| 593 | + strncpy(h->luname,val,LIB3270_LUNAME_LENGTH); | |
| 594 | + } | |
| 595 | + else | |
| 596 | + { | |
| 597 | + lib3270_write_log(h,"","Ignoring invalid URL attribute \"%s\"",var); | |
| 598 | + } | |
| 599 | + | |
| 600 | + | |
| 601 | + } | |
| 602 | + | |
| 603 | + } | |
| 604 | + | |
| 605 | + free(str); | |
| 606 | + } | |
| 607 | + | |
| 608 | + // Notifica atualização | |
| 576 | 609 | update_host(h); |
| 577 | 610 | |
| 578 | 611 | free(str); | ... | ... |
src/lib3270/telnet.c
| ... | ... | @@ -1441,7 +1441,7 @@ static int telnet_fsm(H3270 *hSession, unsigned char c) |
| 1441 | 1441 | if (hSession->lus != (char **)NULL && hSession->try_lu == CN) |
| 1442 | 1442 | { |
| 1443 | 1443 | /* None of the LUs worked. */ |
| 1444 | - popup_an_error(NULL,"Cannot connect to specified LU"); | |
| 1444 | + popup_an_error(hSession, _( "Cannot connect to specified LU" ) ); | |
| 1445 | 1445 | return -1; |
| 1446 | 1446 | } |
| 1447 | 1447 | ... | ... |