mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-16 18:31:14 -03:00
use consistent mechanism to validate var names
Builtin commands that validate var names should use a consistent mechanism. I noticed that builtin_read() had it's own custom code that differed slightly from wcsvarname(). Fixes #3569
This commit is contained in:
@@ -847,7 +847,7 @@ void parse_util_expand_variable_error(const wcstring &token, size_t global_token
|
||||
if (closing_bracket != wcstring::npos) {
|
||||
size_t var_start = dollar_pos + 2, var_end = closing_bracket;
|
||||
var_name = wcstring(token, var_start, var_end - var_start);
|
||||
looks_like_variable = !var_name.empty() && wcsvarname(var_name.c_str()) == NULL;
|
||||
looks_like_variable = wcsvarname(var_name) == NULL;
|
||||
}
|
||||
if (looks_like_variable) {
|
||||
append_syntax_error(
|
||||
|
||||
Reference in New Issue
Block a user