diff --git a/curses.h b/curses.h index 875c0b5f..01d0426e 100644 --- a/curses.h +++ b/curses.h @@ -18,7 +18,7 @@ *************************************************************************** */ /* -$Id: curses.h,v 1.6 2001/05/24 09:01:45 mark Exp $ +$Id: curses.h,v 1.7 2001/10/16 10:33:06 mark Exp $ */ /* *---------------------------------------------------------------------- @@ -169,7 +169,7 @@ PDCurses portable platform definitions list: See notes in wclrtoeol() and wclrtoeof(). **man-end**********************************************************************/ -#define PDC_BUILD 2502 +#define PDC_BUILD 2503 #define PDCURSES 1 /* PDCurses-only routines */ #define XOPEN 1 /* X/Open Curses routines */ #define SYSVcurses 1 /* System V Curses routines */ @@ -1716,6 +1716,7 @@ void PDC_CDECL PDC_set_title( char * ); int PDC_CDECL PDC_getclipboard( char **, long * ); int PDC_CDECL PDC_setclipboard( char *, long ); +int PDC_CDECL PDC_freeclipboard( char * ); int PDC_CDECL PDC_get_input_fd( void ); int PDC_CDECL PDC_curs_set( int ); diff --git a/dos/pdcclip.c b/dos/pdcclip.c index 908a7604..57b0dfa2 100644 --- a/dos/pdcclip.c +++ b/dos/pdcclip.c @@ -25,7 +25,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:28:32 mark Exp $"; +char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.3 2001/10/16 10:33:06 mark Exp $"; #endif @@ -39,7 +39,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:28:32 mark Exp $"; Gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the - memory returned with the free() system call. The length of the + memory returned with the PDC_freeclipboard() call. The length of the clipboard contents is returned in the length argument. PDCurses Return Value: @@ -85,3 +85,28 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length) #endif return PDC_CLIP_ACCESS_ERROR; } + +/*man-start********************************************************************* + + PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard + + PDCurses Description: + This is a PDCurses only routine. + + Frees the memory allocated by PDC_getclipboard(). + + PDCurses Return Value: + Always returns PDC_CLIP_ACCESS_ERROR no clipboard support + + Portability: + PDCurses int PDC_freeclipboard( char *contents ); + +**man-end**********************************************************************/ + +int PDC_CDECL PDC_freeclipboard(char *contents) +{ +#ifdef PDCDEBUG + if (trace_on) PDC_debug("PDC_freeclipboard() - called\n"); +#endif + return PDC_CLIP_ACCESS_ERROR; +} diff --git a/os2/pdcclip.c b/os2/pdcclip.c index bd0c014d..02235ebf 100644 --- a/os2/pdcclip.c +++ b/os2/pdcclip.c @@ -32,7 +32,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:29:29 mark Exp $"; +char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.3 2001/10/16 10:33:06 mark Exp $"; #endif @@ -46,7 +46,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/01/10 08:29:29 mark Exp $"; Gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the - memory returned with the free() system call. The length of the + memory returned with the PDC_freeclipboard() call. The length of the clipboard contents is returned in the length argument. PDCurses Return Value: @@ -191,3 +191,30 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length) return PDC_CLIP_ACCESS_ERROR; #endif } + +/*man-start********************************************************************* + + PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard + + PDCurses Description: + This is a PDCurses only routine. + + Frees the memory allocated by PDC_getclipboard(). + + PDCurses Return Value: + Always returns PDC_CLIP_SUCCESS + + Portability: + PDCurses int PDC_freeclipboard( char *contents ); + +**man-end**********************************************************************/ + +int PDC_CDECL PDC_freeclipboard(char *contents) +{ +#ifdef PDCDEBUG + if (trace_on) PDC_debug("PDC_freeclipboard() - called\n"); +#endif + + free(contents); + return PDC_CLIP_SUCCESS; +} diff --git a/os2/pdcurses.def b/os2/pdcurses.def index 1df42658..9bd49349 100644 --- a/os2/pdcurses.def +++ b/os2/pdcurses.def @@ -16,6 +16,7 @@ EXPORTS COLOR_PAIRS PDC_chadd PDC_chins + PDC_freeclipboard PDC_getclipboard PDC_setclipboard PDC_set_title diff --git a/win32/curses.def b/win32/curses.def index 27cb622a..581661a7 100644 --- a/win32/curses.def +++ b/win32/curses.def @@ -294,3 +294,4 @@ EXPORTS PDC_ungetch EXPORTS PDC_usleep EXPORTS PDC_validchar EXPORTS PDC_vsscanf +EXPORTS PDC_freeclipboard diff --git a/win32/pdcclip.c b/win32/pdcclip.c index e21fe3c6..f0ad2ec9 100644 --- a/win32/pdcclip.c +++ b/win32/pdcclip.c @@ -22,7 +22,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:46 mark Exp $"; +char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/10/16 10:33:06 mark Exp $"; #endif @@ -36,7 +36,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:46 mark Exp $"; Gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the - memory returned with the free() system call. The length of the + memory returned with the PDC_freeclipboard() call. The length of the clipboard contents is returned in the length argument. PDCurses Return Value: @@ -74,7 +74,7 @@ int PDC_CDECL PDC_getclipboard(char **contents, long *length) } len = strlen((char *)handle); - *contents = (char *)malloc(len+1); + *contents = (char *)GlobalAlloc(GMEM_FIXED,len+1); if (!*contents) { CloseClipboard(); @@ -142,3 +142,30 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length) GlobalFree(ptr1); return PDC_CLIP_SUCCESS; } + +/*man-start********************************************************************* + + PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard + + PDCurses Description: + This is a PDCurses only routine. + + Frees the memory allocated by PDC_getclipboard(). + + PDCurses Return Value: + Always returns PDC_CLIP_SUCCESS + + Portability: + PDCurses int PDC_freeclipboard( char *contents ); + +**man-end**********************************************************************/ + +int PDC_CDECL PDC_freeclipboard(char *contents) +{ +#ifdef PDCDEBUG + if (trace_on) PDC_debug("PDC_freeclipboard() - called\n"); +#endif + + GlobalFree(contents); + return PDC_CLIP_SUCCESS; +} diff --git a/x11/pdcclip.c b/x11/pdcclip.c index fecf606f..bbd717cc 100644 --- a/x11/pdcclip.c +++ b/x11/pdcclip.c @@ -24,7 +24,7 @@ #include #ifdef PDCDEBUG -char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:04 mark Exp $"; +char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.2 2001/10/16 10:33:06 mark Exp $"; #endif @@ -38,7 +38,7 @@ char *rcsid_PDCclip = "$Id: pdcclip.c,v 1.1 2001/01/10 08:30:04 mark Exp $"; Gets the textual contents of the system's clipboard. This function returns the contents of the clipboard in the contents argument. It is the responsibilitiy of the caller to free the - memory returned with the free() system call. The length of the + memory returned with the PDC_freeclipboard() call. The length of the clipboard contents is returned in the length argument. PDCurses Return Value: @@ -94,3 +94,30 @@ int PDC_CDECL PDC_setclipboard(char *contents, long length) return XCurses_setclipboard( contents, length ); } + +/*man-start********************************************************************* + + PDC_freeclipboard() - Frees the memory associated with the contents of the clipboard + + PDCurses Description: + This is a PDCurses only routine. + + Frees the memory allocated by PDC_getclipboard(). + + PDCurses Return Value: + Always returns PDC_CLIP_SUCCESS + + Portability: + PDCurses int PDC_freeclipboard( char *contents ); + +**man-end**********************************************************************/ + +int PDC_CDECL PDC_freeclipboard(char *contents) +{ +#ifdef PDCDEBUG + if (trace_on) PDC_debug("PDC_freeclipboard() - called\n"); +#endif + + free(contents); + return PDC_CLIP_SUCCESS; +}