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