From 877b74f9f94c10b8556ff3d236041947b83dd703 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Thu, 15 Mar 2012 19:59:54 +0000 Subject: [PATCH] Iniciando inclusao das funções para paste direto pela biblioteca --- glue.c | 9 ++++----- selection.c | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/glue.c b/glue.c index 7e17b5f..37e3804 100644 --- a/glue.c +++ b/glue.c @@ -139,11 +139,10 @@ void lib3270_session_free(H3270 *h) } // Release memory - if(h->charset) - { - free(h->charset); - h->charset = NULL; - } + #define RELEASE_BUFFER(x) if(x) { free(x); x = NULL; } + + RELEASE_BUFFER(h->charset); + RELEASE_BUFFER(h->paste_buffer); } diff --git a/selection.c b/selection.c index fe243fd..5e44745 100644 --- a/selection.c +++ b/selection.c @@ -344,3 +344,30 @@ LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession) return realloc(ret,sz+1); } + +LIB3270_EXPORT int lib3270_paste(H3270 *h, const char *str) +{ + CHECK_SESSION_HANDLE(h); + + if(!lib3270_connected(h)) + { + lib3270_ring_bell(h); + return 0; + } + + return 0; +} + +LIB3270_EXPORT int lib3270_pastenext(H3270 *h) +{ + CHECK_SESSION_HANDLE(h); + + if(!(lib3270_connected(h) && h->paste_buffer)) + { + lib3270_ring_bell(h); + return 0; + } + + + return 0; +} -- libgit2 0.21.2