diff options
Diffstat (limited to 'src/sys/sys_main.c')
-rw-r--r-- | src/sys/sys_main.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/sys/sys_main.c b/src/sys/sys_main.c index 8d495bdd..ed5f8e5a 100644 --- a/src/sys/sys_main.c +++ b/src/sys/sys_main.c @@ -128,6 +128,35 @@ char *Sys_ConsoleInput(void) return CON_Input( ); } +/* +================== +Sys_GetClipboardData +================== +*/ +char *Sys_GetClipboardData(void) +{ +#ifdef DEDICATED + return NULL; +#else + char *data = NULL; + char *cliptext; + + if ( ( cliptext = SDL_GetClipboardText() ) != NULL ) { + if ( cliptext[0] != '\0' ) { + size_t bufsize = strlen( cliptext ) + 1; + + data = Z_Malloc( bufsize ); + Q_strncpyz( data, cliptext, bufsize ); + + // find first listed char and set to '\0' + strtok( data, "\n\r\b" ); + } + SDL_free( cliptext ); + } + return data; +#endif +} + #ifdef DEDICATED # define PID_FILENAME PRODUCT_NAME "_server.pid" #else |