diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-11-21 20:49:12 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-11-21 20:49:12 -0500 |
commit | 89a92869e56aba4e4cab2d639c00a86f0545c862 (patch) | |
tree | e1cd4da50318af8ab1f3141d39d4b0b8e1e7c500 /variables.c | |
parent | 17345e5ad288f7543b77b23a25aa380eacc279f2 (diff) | |
download | android_external_bash-89a92869e56aba4e4cab2d639c00a86f0545c862.tar.gz android_external_bash-89a92869e56aba4e4cab2d639c00a86f0545c862.tar.bz2 android_external_bash-89a92869e56aba4e4cab2d639c00a86f0545c862.zip |
Bash-4.0 patchlevel 38
Diffstat (limited to 'variables.c')
-rw-r--r-- | variables.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/variables.c b/variables.c index 8920bad..657101b 100644 --- a/variables.c +++ b/variables.c @@ -252,6 +252,7 @@ static SHELL_VAR **fapply __P((sh_var_map_func_t *)); static int visible_var __P((SHELL_VAR *)); static int visible_and_exported __P((SHELL_VAR *)); +static int export_environment_candidate __P((SHELL_VAR *)); static int local_and_exported __P((SHELL_VAR *)); static int variable_in_context __P((SHELL_VAR *)); #if defined (ARRAY_VARS) @@ -375,10 +376,17 @@ initialize_shell_variables (env, privmode) } # endif #endif +#if 0 else if (legal_identifier (name)) +#else + else +#endif { temp_var = bind_variable (name, string, 0); - VSETATTR (temp_var, (att_exported | att_imported)); + if (legal_identifier (name)) + VSETATTR (temp_var, (att_exported | att_imported)); + else + VSETATTR (temp_var, (att_exported | att_imported | att_invisible)); array_needs_making = 1; } @@ -2209,7 +2217,7 @@ bind_variable_internal (name, value, table, hflags, aflags) } else if (assoc_p (entry)) { - assoc_insert (assoc_cell (entry), "0", newval); + assoc_insert (assoc_cell (entry), savestring ("0"), newval); free (newval); } else @@ -3082,6 +3090,16 @@ visible_and_exported (var) return (invisible_p (var) == 0 && exported_p (var)); } +/* Candidate variables for the export environment are either valid variables + with the export attribute or invalid variables inherited from the initial + environment and simply passed through. */ +static int +export_environment_candidate (var) + SHELL_VAR *var; +{ + return (exported_p (var) && (invisible_p (var) == 0 || imported_p (var))); +} + /* Return non-zero if VAR is a local variable in the current context and is exported. */ static int @@ -3438,7 +3456,11 @@ make_var_export_array (vcxt) char **list; SHELL_VAR **vars; +#if 0 vars = map_over (visible_and_exported, vcxt); +#else + vars = map_over (export_environment_candidate, vcxt); +#endif if (vars == 0) return (char **)NULL; |