Commit 67279f8abcc73f35c546ad46fea41ac94de09ee5
1 parent
68b91b26
Exists in
master
and in
5 other branches
Testando interface hllapi
Showing
3 changed files
with
22 additions
and
3 deletions
Show diff stats
src/plugins/remotectl/hllapi.c
| @@ -208,6 +208,24 @@ | @@ -208,6 +208,24 @@ | ||
| 208 | if(result && length && *length && str) | 208 | if(result && length && *length && str) |
| 209 | strncpy(str,strerror(result),*length); | 209 | strncpy(str,strerror(result),*length); |
| 210 | 210 | ||
| 211 | + str[*length] = 0; | ||
| 212 | + | ||
| 213 | +#ifdef DEBUG | ||
| 214 | + { | ||
| 215 | + FILE *arq = fopen("hllapi.dbg","a"); | ||
| 216 | + char *ptr; | ||
| 217 | + | ||
| 218 | + for(ptr=str;*ptr;ptr++) | ||
| 219 | + { | ||
| 220 | + if(*ptr == ' ') | ||
| 221 | + *ptr = '.'; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + fprintf(arq,"func: %ld\nresult: %d\nrc: %d\nLength: %d\nstring: [%s]\n",*func,result,*rc, *length, str); | ||
| 225 | + fclose(arq); | ||
| 226 | + } | ||
| 227 | +#endif // DEBUG | ||
| 228 | + | ||
| 211 | free(arg); | 229 | free(arg); |
| 212 | return result; | 230 | return result; |
| 213 | } | 231 | } |
src/plugins/remotectl/remotectl.c
| @@ -296,6 +296,7 @@ | @@ -296,6 +296,7 @@ | ||
| 296 | attr = g_new0(unsigned short, length+0); | 296 | attr = g_new0(unsigned short, length+0); |
| 297 | text = g_new0(unsigned char, length+1); | 297 | text = g_new0(unsigned char, length+1); |
| 298 | 298 | ||
| 299 | + trace("%s: pos=%d length=%d",__FUNCTION__,pos,length); | ||
| 299 | rc = lib3270_get_contents(hSession,pos,pos+(length-1),text,attr); | 300 | rc = lib3270_get_contents(hSession,pos,pos+(length-1),text,attr); |
| 300 | 301 | ||
| 301 | if(rc) | 302 | if(rc) |
src/plugins/remotectl/testprogram.c
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | #include <stdio.h> | 31 | #include <stdio.h> |
| 32 | #include <pw3270/hllapi.h> | 32 | #include <pw3270/hllapi.h> |
| 33 | 33 | ||
| 34 | - #define BUFFER_LENGTH 4096 | 34 | + #define BUFFER_LENGTH 8000 |
| 35 | 35 | ||
| 36 | /*---[ Implement ]--------------------------------------------------------------------------------*/ | 36 | /*---[ Implement ]--------------------------------------------------------------------------------*/ |
| 37 | 37 | ||
| @@ -68,8 +68,8 @@ | @@ -68,8 +68,8 @@ | ||
| 68 | 68 | ||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | - len = BUFFER_LENGTH; | ||
| 72 | - rc = 1; | 71 | + len = 80; |
| 72 | + rc = 1040; | ||
| 73 | fn = HLLAPI_CMD_COPYPSTOSTR; | 73 | fn = HLLAPI_CMD_COPYPSTOSTR; |
| 74 | result = hllapi(&fn,buffer,&len,&rc); | 74 | result = hllapi(&fn,buffer,&len,&rc); |
| 75 | printf("%s exits with result=%d rc=%d\n%s\n","HLLAPI_CMD_COPYPSTOSTR",result,rc,buffer); | 75 | printf("%s exits with result=%d rc=%d\n%s\n","HLLAPI_CMD_COPYPSTOSTR",result,rc,buffer); |