From 15296dedd56275b1a780f200df0e7719776fd74c Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Thu, 12 Jan 2012 23:07:10 +0530 Subject: [PATCH] Modified kill.cpp to use env_get_string(). --- kill.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/kill.cpp b/kill.cpp index 36426af51..36d4d63cb 100644 --- a/kill.cpp +++ b/kill.cpp @@ -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";