Fix bug in completion code reported by Martin Bähr, as well as other bug evident in his bug report.

darcs-hash:20060826013722-ac50b-08de084a40af8ba5d708a7cd162087b7afbb7648.gz
This commit is contained in:
axel 2006-08-26 11:37:22 +10:00
parent 0a603a56c6
commit 69537430ea
2 changed files with 30 additions and 12 deletions

View file

@ -455,6 +455,8 @@ static int builtin_set( wchar_t **argv )
int slice=0;
int i;
wchar_t *bad_char;
/* Parse options to obtain the requested operation and the modifiers */
woptind = 0;
@ -649,6 +651,15 @@ static int builtin_set( wchar_t **argv )
return 1;
}
if( (bad_char = wcsvarname( dest ) ) )
{
sb_printf( sb_err, BUILTIN_ERR_VARCHAR, argv[0], *bad_char );
builtin_print_help( argv[0], sb_err );
free( dest );
return 1;
}
if( slice && erase && (scope != ENV_USER) )
{
free( dest );

View file

@ -1820,8 +1820,14 @@ static int complete_variable( const wchar_t *var,
if( wcsncmp( var, name, varlen) == 0 )
{
wchar_t *value = expand_escape_variable( env_get( name ));
wchar_t *value_unescaped, *value;
wchar_t *blarg;
value_unescaped = env_get( name );
if( value_unescaped )
{
value = expand_escape_variable( value_unescaped );
/*
Variable description is 'Variable: VALUE
*/
@ -1833,6 +1839,7 @@ static int complete_variable( const wchar_t *var,
al_push( comp, blarg );
}
free( value );
}
}
}