diff options
author | Siteshwar Vashisht <siteshwar@gmail.com> | 2012-01-12 04:19:04 +0530 |
---|---|---|
committer | Siteshwar Vashisht <siteshwar@gmail.com> | 2012-01-12 04:19:04 +0530 |
commit | 48655e882ef02efe50e1b5a05e1b0ae653861c3d (patch) | |
tree | 177904abaf9f154c46651bf3bf6d5e940572bb7d /expand.cpp | |
parent | 7f49d37a5176b11ca6d5f7b40b4405000d4e3c3f (diff) |
Modified expand.cpp and exec.cpp to use env_get_string()
Diffstat (limited to 'expand.cpp')
-rw-r--r-- | expand.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -176,11 +176,11 @@ int expand_is_clean( const wchar_t *in ) /** Return the environment variable value for the string starting at \c in. */ -static wchar_t *expand_var( wchar_t *in ) +static wcstring expand_var( wchar_t *in ) { if( !in ) return 0; - return env_get( in ); + return env_get_string( in ); } /** @@ -958,7 +958,8 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx ) int start_pos = i+1; int stop_pos; int var_len, new_len; - wchar_t * var_val; + const wchar_t * var_val; + wcstring var_val_wstr; wchar_t * new_in; int is_single = (c==VARIABLE_EXPAND_SINGLE); int var_name_stop_pos; @@ -991,7 +992,8 @@ static int expand_variables( wchar_t *in, array_list_t *out, int last_idx ) sb_append_substring( var_tmp, &in[start_pos], var_len ); - var_val = expand_var( (wchar_t *)var_tmp->buff ); + var_val_wstr = expand_var( (wchar_t *)var_tmp->buff ); + var_val = var_val_wstr.empty()?NULL:var_val_wstr.c_str(); if( var_val ) { |