From 88e48ac97a8752c47f697d2f8d6fe420e8dda077 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Thu, 20 Sep 2012 16:55:25 +0000 Subject: [PATCH] Correcoes na interface HLLAPI --- po/pt_BR.po | 8 ++++---- src/plugins/remotectl/hllapi.c | 25 ++++++++++--------------- src/plugins/remotectl/testprogram.c | 5 ++--- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/po/pt_BR.po b/po/pt_BR.po index eeb221b..727876d 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: pw3270 5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-09-19 09:13-0300\n" +"POT-Creation-Date: 2012-09-20 09:55-0300\n" "PO-Revision-Date: 2012-09-14 14:32-0300\n" "Last-Translator: Perry Werneck \n" "Language-Team: Português \n" @@ -128,7 +128,7 @@ msgstr "Não foi possível conectar a %s:%d" msgid "Can't connect to host" msgstr "Não foi possível conectar ao servidor" -#: selection.c:603 +#: selection.c:601 msgid "Can't cut rectangular regions" msgstr "Recortar não permitido em seleção retangular" @@ -417,7 +417,7 @@ msgstr "Invalid CGCSGID '%s', ignoring" msgid "Invalid charset entry '%s' (#%d)" msgstr "Invalid charset entry '%s' (#%d)" -#: selection.c:603 +#: selection.c:601 msgid "Invalid cut action" msgstr "Ação recortar inválida" @@ -474,7 +474,7 @@ msgstr "Erro ao iniciar a rede" msgid "Next field" msgstr "Próximo campo" -#: selection.c:603 +#: selection.c:601 msgid "Not available" msgstr "Não disponível" diff --git a/src/plugins/remotectl/hllapi.c b/src/plugins/remotectl/hllapi.c index 911656a..8a84983 100644 --- a/src/plugins/remotectl/hllapi.c +++ b/src/plugins/remotectl/hllapi.c @@ -58,7 +58,7 @@ snprintf(PipeName,4095,"\\\\.\\pipe\\%s",name); if(!WaitNamedPipe(PipeName,NMPWAIT_USE_DEFAULT_WAIT)) - return ETIMEDOUT; + return ENOENT; hPipe = CreateFile(PipeName,GENERIC_WRITE|GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL); @@ -90,8 +90,7 @@ if(hPipe == INVALID_HANDLE_VALUE) { - trace("Invalid pipe handle %ld",(unsigned long) hPipe); - result = EPERM; + *rc = result = EPERM; } else { @@ -116,7 +115,7 @@ memset(buffer,0,HLLAPI_MAXLENGTH); if(!TransactNamedPipe(hPipe,(LPVOID) data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NULL)) { - result = GetLastError(); + *rc = result = GetLastError(); } else { @@ -124,8 +123,6 @@ *rc = buffer->rc; - trace("%s: Query rc=%d",__FUNCTION__,(int) buffer->rc); - if(string && sz > 0) memcpy(string,buffer->string,sz); @@ -155,7 +152,7 @@ char * arg; if(!length || *length > HLLAPI_MAXLENGTH) - return EINVAL; + return *rc = EINVAL; if(length > 0) { @@ -169,16 +166,10 @@ *arg = 0; } -/* -#ifdef DEBUG - freopen("hllapi.log","a",stderr); -#endif // DEBUG -*/ - switch(*func) { case HLLAPI_CMD_CONNECTPS: - result = cmd_connect_ps(arg); + *rc = result = cmd_connect_ps(arg); if(!result) { result = run_query(*func, arg, str, *length, rc); @@ -189,13 +180,17 @@ hPipe = INVALID_HANDLE_VALUE; } } + else + { + *rc = result; + } break; case HLLAPI_CMD_DISCONNECTPS: #ifdef WIN32 if(hPipe == INVALID_HANDLE_VALUE) { - result = EINVAL; + *rc = result = EINVAL; } else { diff --git a/src/plugins/remotectl/testprogram.c b/src/plugins/remotectl/testprogram.c index ad6cd77..b7df420 100644 --- a/src/plugins/remotectl/testprogram.c +++ b/src/plugins/remotectl/testprogram.c @@ -64,7 +64,7 @@ len = BUFFER_LENGTH; strcpy(buffer,cmd[f].arg); result = hllapi(&cmd[f].fn,buffer,&len,&rc); - printf("%s exits with %d\n[%s]\n",cmd[f].name,result,buffer); + printf("%s exits with result=%d rc=%d\n[%s]\n",cmd[f].name,result,rc,buffer); } @@ -72,8 +72,7 @@ rc = 1; fn = HLLAPI_CMD_COPYPSTOSTR; result = hllapi(&fn,buffer,&len,&rc); - printf("%s exits with %d\n%s\n","HLLAPI_CMD_COPYPSTOSTR",result,buffer); - + printf("%s exits with result=%d rc=%d\n%s\n","HLLAPI_CMD_COPYPSTOSTR",result,rc,buffer); // Disconnect len = BUFFER_LENGTH; -- libgit2 0.21.2