Commit 877b74f9f94c10b8556ff3d236041947b83dd703
1 parent
c8e97bcc
Exists in
master
and in
3 other branches
Iniciando inclusao das funções para paste direto pela biblioteca
Showing
2 changed files
with
31 additions
and
5 deletions
Show diff stats
glue.c
@@ -139,11 +139,10 @@ void lib3270_session_free(H3270 *h) | @@ -139,11 +139,10 @@ void lib3270_session_free(H3270 *h) | ||
139 | } | 139 | } |
140 | 140 | ||
141 | // Release memory | 141 | // Release memory |
142 | - if(h->charset) | ||
143 | - { | ||
144 | - free(h->charset); | ||
145 | - h->charset = NULL; | ||
146 | - } | 142 | + #define RELEASE_BUFFER(x) if(x) { free(x); x = NULL; } |
143 | + | ||
144 | + RELEASE_BUFFER(h->charset); | ||
145 | + RELEASE_BUFFER(h->paste_buffer); | ||
147 | 146 | ||
148 | } | 147 | } |
149 | 148 |
selection.c
@@ -344,3 +344,30 @@ LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) | @@ -344,3 +344,30 @@ LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) | ||
344 | 344 | ||
345 | return realloc(ret,sz+1); | 345 | return realloc(ret,sz+1); |
346 | } | 346 | } |
347 | + | ||
348 | +LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str) | ||
349 | +{ | ||
350 | + CHECK_SESSION_HANDLE(h); | ||
351 | + | ||
352 | + if(!lib3270_connected(h)) | ||
353 | + { | ||
354 | + lib3270_ring_bell(h); | ||
355 | + return 0; | ||
356 | + } | ||
357 | + | ||
358 | + return 0; | ||
359 | +} | ||
360 | + | ||
361 | +LIB3270_EXPORT int lib3270_pastenext(H3270 *h) | ||
362 | +{ | ||
363 | + CHECK_SESSION_HANDLE(h); | ||
364 | + | ||
365 | + if(!(lib3270_connected(h) && h->paste_buffer)) | ||
366 | + { | ||
367 | + lib3270_ring_bell(h); | ||
368 | + return 0; | ||
369 | + } | ||
370 | + | ||
371 | + | ||
372 | + return 0; | ||
373 | +} |