Modified kill.cpp to use env_get_string().

This commit is contained in:
Siteshwar Vashisht 2012-01-12 23:07:10 +05:30
parent 943cc68f54
commit 15296dedd5

View file

@ -104,11 +104,13 @@ void kill_add( wchar_t *str )
I couldn't think of a safe way to allow overide of the echo 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. 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 ); 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 else
{ {
@ -117,8 +119,9 @@ void kill_add( wchar_t *str )
return; return;
} }
wchar_t *disp; const wcstring disp_wstr = env_get_string( L"DISPLAY" );
if( (disp = env_get( L"DISPLAY" )) ) // wchar_t *disp = disp_wstr.empty()?NULL:disp_wstr.c_str();
if( !disp_wstr.empty() )
{ {
escaped_str = escape( str, 1 ); escaped_str = escape( str, 1 );
cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" ); cmd = wcsdupcat(L"echo ", escaped_str, L"|xsel -b" );
@ -215,13 +218,13 @@ wchar_t *kill_yank_rotate()
*/ */
static void kill_check_x_buffer() static void kill_check_x_buffer()
{ {
wchar_t *disp; wcstring disp;
if( !has_xsel() ) if( !has_xsel() )
return; return;
if( (disp = env_get( L"DISPLAY" )) ) if( (!(disp = env_get_string( L"DISPLAY" )).empty()) )
{ {
size_t i; size_t i;
wcstring cmd = L"xsel -t 500 -b"; wcstring cmd = L"xsel -t 500 -b";