Commit cf5ab837ec239740ceccc3296e7fb319407626a3

Authored by Perry Werneck
1 parent 1953ac0d

Incluindo opção para definir o delimitador de linha ao carregar o conteúdo da tela.

Showing 3 changed files with 7 additions and 7 deletions   Show diff stats
@@ -103,7 +103,7 @@ @@ -103,7 +103,7 @@
103 switch(argc) 103 switch(argc)
104 { 104 {
105 case 1: // Get entire screen 105 case 1: // Get entire screen
106 - buffer = lib3270_get_text(hSession,0,-1); 106 + buffer = lib3270_get_text(hSession,0,-1,'\n');
107 break; 107 break;
108 108
109 /* 109 /*
@@ -374,7 +374,7 @@ void screen_update(H3270 *session, int bstart, int bend) @@ -374,7 +374,7 @@ void screen_update(H3270 *session, int bstart, int bend)
374 374
375 #ifdef DEBUG 375 #ifdef DEBUG
376 { 376 {
377 - char *text = lib3270_get_text(session,0,-1); 377 + char *text = lib3270_get_text(session,0,-1,'\n');
378 trace("First screen:\n%s\n",text); 378 trace("First screen:\n%s\n",text);
379 lib3270_free(text); 379 lib3270_free(text);
380 } 380 }
@@ -475,7 +475,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u @@ -475,7 +475,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u
475 return lib3270_realloc(text,sz); 475 return lib3270_realloc(text,sz);
476 } 476 }
477 477
478 -LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) 478 +LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len, char lf)
479 { 479 {
480 char * buffer; 480 char * buffer;
481 int maxlen; 481 int maxlen;
@@ -517,9 +517,9 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) @@ -517,9 +517,9 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len)
517 offset++; 517 offset++;
518 len--; 518 len--;
519 519
520 - if((offset%h->cols) == 0 && len > 0) 520 + if(lf && (offset%h->cols) == 0 && len > 0)
521 { 521 {
522 - *(ptr++) = '\n'; 522 + *(ptr++) = lf;
523 len--; 523 len--;
524 } 524 }
525 } 525 }
@@ -533,7 +533,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len) @@ -533,7 +533,7 @@ LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len)
533 LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len) 533 LIB3270_EXPORT char * lib3270_get_text_at(H3270 *h, int row, int col, int len)
534 { 534 {
535 CHECK_SESSION_HANDLE(h); 535 CHECK_SESSION_HANDLE(h);
536 - return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len); 536 + return lib3270_get_text(h, ((row-1) * h->cols) + (col-1), len, '\n');
537 } 537 }
538 538
539 LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text) 539 LIB3270_EXPORT int lib3270_cmp_text_at(H3270 *h, int row, int col, const char *text)
@@ -569,7 +569,7 @@ LIB3270_EXPORT char * lib3270_get_field_at(H3270 *session, int baddr) @@ -569,7 +569,7 @@ LIB3270_EXPORT char * lib3270_get_field_at(H3270 *session, int baddr)
569 if(first < 0) 569 if(first < 0)
570 return NULL; 570 return NULL;
571 571
572 - return lib3270_get_text(session,first,lib3270_field_length(session,first)+1); 572 + return lib3270_get_text(session,first,lib3270_field_length(session,first)+1,0);
573 } 573 }
574 574
575 LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession) 575 LIB3270_EXPORT int lib3270_has_selection(H3270 *hSession)