mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-08 19:22:39 +02:00
bash-4.4 beta2 release
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* general.c -- Stuff that is used by all files. */
|
||||
|
||||
/* Copyright (C) 1987-2015 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2016 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -227,6 +227,57 @@ legal_identifier (name)
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* Return 1 if NAME is a valid value that can be assigned to a nameref
|
||||
variable. FLAGS can be 2, in which case the name is going to be used
|
||||
to create a variable. Other values are currently unused, but could
|
||||
be used to allow values to be stored and indirectly referenced, but
|
||||
not used in assignments. */
|
||||
int
|
||||
valid_nameref_value (name, flags)
|
||||
char *name;
|
||||
int flags;
|
||||
{
|
||||
if (name == 0 || *name == 0)
|
||||
return 0;
|
||||
|
||||
/* valid identifier */
|
||||
#if defined (ARRAY_VARS)
|
||||
if (legal_identifier (name) || (flags != 2 && valid_array_reference (name, 0)))
|
||||
#else
|
||||
if (legal_identifier (name))
|
||||
#endif
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
check_selfref (name, value, flags)
|
||||
const char *name;
|
||||
const char *value;
|
||||
int flags;
|
||||
{
|
||||
char *t;
|
||||
|
||||
if (STREQ (name, value))
|
||||
return 1;
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
if (valid_array_reference (value, 0))
|
||||
{
|
||||
t = array_variable_name (value, (int *)NULL, (int *)NULL);
|
||||
if (t && STREQ (name, t))
|
||||
{
|
||||
free (t);
|
||||
return 1;
|
||||
}
|
||||
free (t);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0; /* not a self reference */
|
||||
}
|
||||
|
||||
/* Make sure that WORD is a valid shell identifier, i.e.
|
||||
does not contain a dollar sign, nor is quoted in any way. Nor
|
||||
does it consist of all digits. If CHECK_WORD is non-zero,
|
||||
@@ -1039,6 +1090,7 @@ bash_tilde_expand (s, assign_p)
|
||||
int old_immed, old_term, r;
|
||||
char *ret;
|
||||
|
||||
#if 0
|
||||
old_immed = interrupt_immediately;
|
||||
old_term = terminate_immediately;
|
||||
/* We want to be able to interrupt tilde expansion. Ordinarily, we can just
|
||||
@@ -1048,6 +1100,7 @@ bash_tilde_expand (s, assign_p)
|
||||
if (any_signals_trapped () < 0)
|
||||
interrupt_immediately = 1;
|
||||
terminate_immediately = 1;
|
||||
#endif
|
||||
|
||||
tilde_additional_prefixes = assign_p == 0 ? (char **)0
|
||||
: (assign_p == 2 ? bash_tilde_prefixes2 : bash_tilde_prefixes);
|
||||
@@ -1057,8 +1110,10 @@ bash_tilde_expand (s, assign_p)
|
||||
r = (*s == '~') ? unquoted_tilde_word (s) : 1;
|
||||
ret = r ? tilde_expand (s) : savestring (s);
|
||||
|
||||
#if 0
|
||||
interrupt_immediately = old_immed;
|
||||
terminate_immediately = old_term;
|
||||
#endif
|
||||
|
||||
QUIT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user