From 3af8230be2efa9780b51ecb1ca514dd511d0c8dc Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Mon, 10 Mar 2014 17:34:24 +0000 Subject: [PATCH] Incluindo opção para incluir o nome da LU na URL de conexão --- host.c | 33 +++++++++++++++++++++++++++++++++ telnet.c | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/host.c b/host.c index 3f86d31..0d4d3f7 100644 --- a/host.c +++ b/host.c @@ -573,6 +573,39 @@ LIB3270_EXPORT const char * lib3270_set_url(H3270 *h, const char *n) Replace(h->host.current,strdup(hostname)); Replace(h->host.srvc,strdup(srvc)); + // Verifica parâmetros + if(query && *query) + { + char *str = strdup(query); + char *saveptr = NULL; + char *ptr; + + for(ptr = strtok_r(str,"&",&saveptr);ptr;ptr=strtok_r(NULL,"&",&saveptr)) + { + char *var = ptr; + char *val = strchr(ptr,'='); + if(val) + { + *(val++) = 0; + + if(!(strcasecmp(var,"lu") && strcasecmp(var,"luname"))) + { + strncpy(h->luname,val,LIB3270_LUNAME_LENGTH); + } + else + { + lib3270_write_log(h,"","Ignoring invalid URL attribute \"%s\"",var); + } + + + } + + } + + free(str); + } + + // Notifica atualização update_host(h); free(str); diff --git a/telnet.c b/telnet.c index 829f0ee..299fd4d 100644 --- a/telnet.c +++ b/telnet.c @@ -1441,7 +1441,7 @@ static int telnet_fsm(H3270 *hSession, unsigned char c) if (hSession->lus != (char **)NULL && hSession->try_lu == CN) { /* None of the LUs worked. */ - popup_an_error(NULL,"Cannot connect to specified LU"); + popup_an_error(hSession, _( "Cannot connect to specified LU" ) ); return -1; } -- libgit2 0.21.2