mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 02:32:46 +08:00
Mangle very long variable values when using the set builtin to print variables and their values
darcs-hash:20061004181901-ac50b-a043695fa8fffe877970a51dd042c4bf623a770c.gz
This commit is contained in:
parent
80ff583400
commit
53a2c017fe
|
@ -368,9 +368,23 @@ static void print_variables(int include_values, int esc, int scope)
|
|||
wchar_t *e_value;
|
||||
if( value )
|
||||
{
|
||||
int shorten = 0;
|
||||
|
||||
if( wcslen( value ) > 64 )
|
||||
{
|
||||
shorten = 1;
|
||||
value = wcsndup( value, 60 );
|
||||
if( !value )
|
||||
DIE_MEM();
|
||||
}
|
||||
e_value = esc ? expand_escape_variable(value) : wcsdup(value);
|
||||
sb_append2(sb_out, L" ", e_value, (void *)0);
|
||||
free(e_value);
|
||||
if( shorten )
|
||||
{
|
||||
sb_append(sb_out, L"\u2026");
|
||||
free( value );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user