Commit ef87acc7050fde81140bdc1742d9f60514b5f01c
1 parent
842267b7
Exists in
master
and in
3 other branches
Implementando plugin dbus, adicionando funcoes para obter e testar conteudo da t…
…ela pela posição em linha/coluna, incluindo projeto codeblocks do sample no pacote devel
Showing
1 changed file
with
30 additions
and
0 deletions
Show diff stats
selection.c
| ... | ... | @@ -465,6 +465,8 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) |
| 465 | 465 | return NULL; |
| 466 | 466 | |
| 467 | 467 | maxlen = (h->rows * (h->cols+1)) - offset; |
| 468 | + if(maxlen <= 0) | |
| 469 | + return NULL; | |
| 468 | 470 | |
| 469 | 471 | if(len < 0 || len > maxlen) |
| 470 | 472 | len = maxlen; |
| ... | ... | @@ -500,6 +502,34 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) |
| 500 | 502 | return buffer; |
| 501 | 503 | } |
| 502 | 504 | |
| 505 | +LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) | |
| 506 | +{ | |
| 507 | + CHECK_SESSION_HANDLE(h); | |
| 508 | + | |
| 509 | + if(!lib3270_connected(h)) | |
| 510 | + return NULL; | |
| 511 | + | |
| 512 | + return lib3270_get_text(h, ((row) * h->cols) + col, len); | |
| 513 | +} | |
| 514 | + | |
| 515 | +LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text) | |
| 516 | +{ | |
| 517 | + int rc; | |
| 518 | + size_t sz = strlen(text); | |
| 519 | + char * contents; | |
| 520 | + | |
| 521 | + contents = lib3270_get_text_at(h,row,col,sz); | |
| 522 | + if(!contents) | |
| 523 | + return -1; | |
| 524 | + | |
| 525 | + rc = strncmp(contents,text,sz); | |
| 526 | + | |
| 527 | + lib3270_free(contents); | |
| 528 | + | |
| 529 | + return rc; | |
| 530 | +} | |
| 531 | + | |
| 532 | + | |
| 503 | 533 | /** |
| 504 | 534 | * Get field contents |
| 505 | 535 | * | ... | ... |