diff --git a/src/plugins/remotectl/hllapi.c b/src/plugins/remotectl/hllapi.c index 8a84983..d14019a 100644 --- a/src/plugins/remotectl/hllapi.c +++ b/src/plugins/remotectl/hllapi.c @@ -208,6 +208,24 @@ if(result && length && *length && str) strncpy(str,strerror(result),*length); + str[*length] = 0; + +#ifdef DEBUG + { + FILE *arq = fopen("hllapi.dbg","a"); + char *ptr; + + for(ptr=str;*ptr;ptr++) + { + if(*ptr == ' ') + *ptr = '.'; + } + + fprintf(arq,"func: %ld\nresult: %d\nrc: %d\nLength: %d\nstring: [%s]\n",*func,result,*rc, *length, str); + fclose(arq); + } +#endif // DEBUG + free(arg); return result; } diff --git a/src/plugins/remotectl/remotectl.c b/src/plugins/remotectl/remotectl.c index 0270589..fbd5dca 100644 --- a/src/plugins/remotectl/remotectl.c +++ b/src/plugins/remotectl/remotectl.c @@ -296,6 +296,7 @@ attr = g_new0(unsigned short, length+0); text = g_new0(unsigned char, length+1); + trace("%s: pos=%d length=%d",__FUNCTION__,pos,length); rc = lib3270_get_contents(hSession,pos,pos+(length-1),text,attr); if(rc) diff --git a/src/plugins/remotectl/testprogram.c b/src/plugins/remotectl/testprogram.c index b7df420..3af3547 100644 --- a/src/plugins/remotectl/testprogram.c +++ b/src/plugins/remotectl/testprogram.c @@ -31,7 +31,7 @@ #include #include - #define BUFFER_LENGTH 4096 + #define BUFFER_LENGTH 8000 /*---[ Implement ]--------------------------------------------------------------------------------*/ @@ -68,8 +68,8 @@ } - len = BUFFER_LENGTH; - rc = 1; + len = 80; + rc = 1040; fn = HLLAPI_CMD_COPYPSTOSTR; result = hllapi(&fn,buffer,&len,&rc); printf("%s exits with result=%d rc=%d\n%s\n","HLLAPI_CMD_COPYPSTOSTR",result,rc,buffer); -- libgit2 0.21.2