diff options
author | 2012-01-12 23:07:10 +0530 | |
---|---|---|
committer | 2012-01-12 23:07:10 +0530 | |
commit | 15296dedd56275b1a780f200df0e7719776fd74c (patch) | |
tree | 46c449d7e302de22dd37e9f71d35f4457082d746 | |
parent | 943cc68f54b2b4d8aadc3b262992e2b150edaf3a (diff) |
Modified kill.cpp to use env_get_string().
-rw-r--r-- | kill.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -104,11 +104,13 @@ void kill_add( wchar_t *str ) I couldn't think of a safe way to allow overide of the echo command too, so, the command used must accept the input via stdin. */ - wchar_t *clipboard; - if( (clipboard = env_get(L"FISH_CLIPBOARD_CMD")) ) + + const wcstring clipboard_wstr = env_get_string(L"FISH_CLIPBOARD_CMD"); +// const wchar_t *clipboard = clipboard_wstr.empty()?NULL:clipboard.c_str(); + if( !clipboard_wstr.empty() ) { escaped_str = escape( str, 1 ); - cmd = wcsdupcat(L"echo -n ", escaped_str, clipboard); + cmd = wcsdupcat(L"echo -n ", escaped_str, clipboard_wstr.c_str()); } else { @@ -117,8 +119,9 @@ void kill_add( wchar_t *str ) return; } - wchar_t *disp; - if( (disp = env_get( L"DISPLAY" )) ) + const wcstring disp_wstr = env_get_string( L"DISPLAY" ); +// wchar_t *disp = disp_wstr.empty()?NULL:disp_wstr.c_str(); + if( !disp_wstr.empty() ) { escaped_str = escape( str, 1 ); cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" ); @@ -215,13 +218,13 @@ wchar_t *kill_yank_rotate() */ static void kill_check_x_buffer() { - wchar_t *disp; + wcstring disp; if( !has_xsel() ) return; - if( (disp = env_get( L"DISPLAY" )) ) + if( (!(disp = env_get_string( L"DISPLAY" )).empty()) ) { size_t i; wcstring cmd = L"xsel -t 500 -b"; |