Commit 0b2a74c32c0c2cbd0d8ea054dd23d1dacf171939

Authored by perry.werneck@gmail.com
1 parent d6f4f92b

Incluindo opção para incluir o nome da LU na URL de conexão

src/include/lib3270/session.h
... ... @@ -126,7 +126,6 @@
126 126 } toggle[LIB3270_TOGGLE_COUNT];
127 127  
128 128 // Network & Termtype
129   -// char * hostname;
130 129 char * connected_type;
131 130 char * connected_lu;
132 131 char luname[LIB3270_LUNAME_LENGTH+1];
... ...
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  
... ...