Bash
5.0-beta2
Bash - Bourne Again shell
|
#include "config.h"
#include "bashtypes.h"
#include "posixstat.h"
#include "posixtime.h"
#include <stdio.h>
#include "chartypes.h"
#include "bashansi.h"
#include "bashintl.h"
#include "shell.h"
#include "parser.h"
#include "flags.h"
#include "execute_cmd.h"
#include "findcmd.h"
#include "mailcheck.h"
#include "input.h"
#include "hashcmd.h"
#include "pathexp.h"
#include "alias.h"
#include "jobs.h"
#include "version.h"
#include "builtins/getopt.h"
#include "builtins/common.h"
#include "builtins/builtext.h"
#include <tilde/tilde.h>
Go to the source code of this file.
Data Structures | |
struct | saved_dollar_vars |
struct | name_and_function |
Macros | |
#define | NEED_XTRACE_SET_DECL |
#define | VARIABLES_HASH_BUCKETS 1024 /* must be power of two */ |
#define | FUNCTIONS_HASH_BUCKETS 512 |
#define | TEMPENV_HASH_BUCKETS 4 /* must be power of two */ |
#define | BASHFUNC_PREFIX "BASH_FUNC_" |
#define | BASHFUNC_PREFLEN 10 /* == strlen(BASHFUNC_PREFIX */ |
#define | BASHFUNC_SUFFIX "%%" |
#define | BASHFUNC_SUFFLEN 2 /* == strlen(BASHFUNC_SUFFIX) */ |
#define | FV_FORCETEMPENV 0x01 |
#define | FV_SKIPINVISIBLE 0x02 |
#define | INIT_DYNAMIC_VAR(var, val, gfunc, afunc) |
#define | INIT_DYNAMIC_ARRAY_VAR(var, gfunc, afunc) |
#define | INIT_DYNAMIC_ASSOC_VAR(var, gfunc, afunc) |
#define | FIND_OR_MAKE_VARIABLE(name, entry) |
#define | USE_EXPORTSTR (value == var->exportstr) |
#define | add_to_export_env(envstr, do_alloc) |
#define | SET_INT_VAR(name, intvar) intvar = find_variable (name) != 0 |
#define | N_SPECIAL_VARS (sizeof (special_vars) / sizeof (special_vars[0]) - 1) |
#define | MIN_COMPAT_LEVEL 31 |
struct saved_dollar_vars |
Definition at line 5328 of file variables.c.
Data Fields | ||
---|---|---|
char ** | first_ten | |
WORD_LIST * | rest |
struct name_and_function |
Definition at line 5554 of file variables.c.
Data Fields | ||
---|---|---|
char * | name | |
sh_sv_func_t * | function |
#define NEED_XTRACE_SET_DECL |
Definition at line 47 of file variables.c.
#define VARIABLES_HASH_BUCKETS 1024 /* must be power of two */ |
Definition at line 83 of file variables.c.
Referenced by create_variable_tables(), push_posix_temp_var(), push_posix_tempvar_internal(), and push_temp_var().
#define FUNCTIONS_HASH_BUCKETS 512 |
Definition at line 84 of file variables.c.
Referenced by create_variable_tables().
#define TEMPENV_HASH_BUCKETS 4 /* must be power of two */ |
Definition at line 85 of file variables.c.
Referenced by assign_in_env(), make_local_variable(), and push_temp_var().
#define BASHFUNC_PREFIX "BASH_FUNC_" |
Definition at line 87 of file variables.c.
Referenced by initialize_shell_variables(), and mk_env_string().
#define BASHFUNC_PREFLEN 10 /* == strlen(BASHFUNC_PREFIX */ |
Definition at line 88 of file variables.c.
Referenced by initialize_shell_variables(), and mk_env_string().
#define BASHFUNC_SUFFIX "%%" |
Definition at line 89 of file variables.c.
Referenced by initialize_shell_variables(), and mk_env_string().
#define BASHFUNC_SUFFLEN 2 /* == strlen(BASHFUNC_SUFFIX) */ |
Definition at line 90 of file variables.c.
Referenced by initialize_shell_variables(), and mk_env_string().
#define FV_FORCETEMPENV 0x01 |
Definition at line 94 of file variables.c.
Referenced by find_variable(), find_variable_for_assignment(), find_variable_internal(), find_variable_last_nameref(), find_variable_nameref(), find_variable_no_invisible(), find_variable_noref(), and find_variable_tempenv().
#define FV_SKIPINVISIBLE 0x02 |
Definition at line 95 of file variables.c.
Referenced by find_variable_internal(), and find_variable_no_invisible().
#define INIT_DYNAMIC_VAR | ( | var, | |
val, | |||
gfunc, | |||
afunc | |||
) |
Definition at line 1165 of file variables.c.
Referenced by init_funcname_var(), init_seconds_var(), and initialize_dynamic_variables().
#define INIT_DYNAMIC_ARRAY_VAR | ( | var, | |
gfunc, | |||
afunc | |||
) |
Definition at line 1174 of file variables.c.
Referenced by get_self(), and init_funcname_var().
#define INIT_DYNAMIC_ASSOC_VAR | ( | var, | |
gfunc, | |||
afunc | |||
) |
Definition at line 1183 of file variables.c.
Referenced by get_self().
#define FIND_OR_MAKE_VARIABLE | ( | name, | |
entry | |||
) |
Definition at line 3981 of file variables.c.
Referenced by set_var_read_only().
#define USE_EXPORTSTR (value == var->exportstr) |
Referenced by make_env_array_from_var_list().
#define add_to_export_env | ( | envstr, | |
do_alloc | |||
) |
Definition at line 4799 of file variables.c.
Referenced by add_or_supercede_exported_var(), and add_temp_array_to_env().
#define SET_INT_VAR | ( | name, | |
intvar | |||
) | intvar = find_variable (name) != 0 |
Definition at line 5551 of file variables.c.
#define N_SPECIAL_VARS (sizeof (special_vars) / sizeof (special_vars[0]) - 1) |
Definition at line 5643 of file variables.c.
Referenced by stupidly_hack_special_variables().
#define MIN_COMPAT_LEVEL 31 |
Definition at line 6240 of file variables.c.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
inlinestatic |
|
static |
|
static |
|
static |
|
inlinestatic |
|
static |
Definition at line 314 of file variables.c.
References FUNCTIONS_HASH_BUCKETS, hash_create(), new_var_context(), NULL, var_context::scope, var_context::table, and VARIABLES_HASH_BUCKETS.
Referenced by bind_global_variable(), bind_variable(), initialize_shell_variables(), make_new_variable(), and set_if_not().
void initialize_shell_variables | ( | char ** | env, |
int | privmode | ||
) |
Definition at line 336 of file variables.c.
References _(), absolute_program(), array_needs_making, att_exported, att_imported, att_integer, att_invisible, att_readonly, bash_tilde_expand(), BASHFUNC_PREFIX, BASHFUNC_PREFLEN, BASHFUNC_SUFFIX, BASHFUNC_SUFFLEN, bind_invalid_envvar(), bind_variable(), c, CACHE_IMPORTSTR, command_execution_string, create_variable_tables(), current_user, DEFAULT_PATH_VALUE, dollar_dollar_pid, dollar_vars, user_info::euid, find_function(), find_variable(), free(), FREE, function_p, get_bash_name(), get_current_user_info(), getpid(), imported_p, initialize_dynamic_variables(), initialize_shell_level(), interactive_shell, last_command_exit_value, legal_identifier(), login_shell, variable::name, no_line_editing, NULL, parse_and_execute(), posixly_correct, primary_prompt, read_but_dont_execute, readonly_p, remember_on_history, report_error(), rl_prefer_env_winsize, secondary_prompt, seedrand(), set_auto_export, set_home_var(), set_if_not(), set_machine_vars(), set_ppid(), set_pwd(), set_shell_var(), setifs(), SEVAL_FUNCDEF, SEVAL_NOHIST, SEVAL_NONINT, SEVAL_ONECMD, sh_opterr, shell_version_string(), STREQ, STREQN, string, sv_funcnest(), sv_ignoreeof(), sv_shcompat(), sv_strict_posix(), sv_xtracefd(), user_info::uid, uidset(), VSETATTR, VUNSETATTR, and xmalloc().
Referenced by shell_initialize().
|
static |
Definition at line 674 of file variables.c.
References current_host_name, HOSTTYPE, MACHTYPE, OSTYPE, and set_if_not().
Referenced by initialize_shell_variables().
char* sh_get_home_dir | ( | void | ) |
Definition at line 691 of file variables.c.
References current_user, get_current_user_info(), getpwuid(), getuid, user_info::home_dir, NULL, and savestring().
Referenced by set_home_var(), and tilde_expand_word().
|
static |
Definition at line 699 of file variables.c.
References att_exported, bind_variable(), find_variable(), sh_get_home_dir(), and VSETATTR.
Referenced by initialize_shell_variables().
|
static |
Definition at line 714 of file variables.c.
References att_exported, bind_variable(), current_user, find_variable(), get_current_user_info(), user_info::shell, and VSETATTR.
Referenced by initialize_shell_variables().
|
static |
Definition at line 731 of file variables.c.
References ABSPATH, current_user, file_status(), find_user_command(), free(), FS_EXECABLE, full_pathname(), get_current_user_info(), get_string_value(), login_shell, make_absolute(), PATH_CHECKDOTDOT, PATH_CHECKEXISTS, RELPATH, savestring(), sh_canonpath(), user_info::shell, shell_name, strcpy(), and xmalloc().
Referenced by initialize_shell_variables().
void adjust_shell_level | ( | int | change | ) |
Definition at line 804 of file variables.c.
References _(), bind_variable(), get_string_value(), internal_warning(), legal_number(), set_auto_export, and shell_level.
Referenced by execute_disk_command(), initialize_shell_level(), and push_builtin().
|
static |
Definition at line 850 of file variables.c.
References adjust_shell_level().
Referenced by initialize_shell_variables().
void set_pwd | ( | ) |
Definition at line 863 of file variables.c.
References att_exported, att_invisible, bind_variable(), file_isdir(), find_variable(), free(), get_working_directory(), imported_p, interactive_shell, login_shell, NULL, PATH_CHECKDOTDOT, PATH_CHECKEXISTS, posixly_correct, same_file(), set_auto_export, set_working_directory(), sh_canonpath(), value_cell, and VSETATTR.
Referenced by initialize_shell_variables().
void set_ppid | ( | ) |
Definition at line 926 of file variables.c.
References att_exported, att_integer, att_readonly, bind_variable(), find_variable(), INT_STRLEN_BOUND, inttostr(), VSETATTR, and VUNSETATTR.
Referenced by initialize_shell_variables(), and push_builtin().
|
static |
Definition at line 940 of file variables.c.
References array_cell, att_integer, att_readonly, bind_variable(), build_version, current_user, dist_version, user_info::euid, find_variable(), INT_STRLEN_BOUND, inttostr(), MACHTYPE, patch_level, release_status, strchr(), strcpy(), user_info::uid, unbind_variable_noref(), and VSETATTR.
Referenced by initialize_shell_variables().
void sh_set_lines_and_columns | ( | int | lines, |
int | cols | ||
) |
Definition at line 996 of file variables.c.
References bind_variable(), INT_STRLEN_BOUND, inttostr(), and val.
void print_var_list | ( | SHELL_VAR ** | list | ) |
Definition at line 1023 of file variables.c.
References i, invisible_p, and print_assignment().
void print_func_list | ( | SHELL_VAR ** | list | ) |
Definition at line 1037 of file variables.c.
References i, and print_var_function().
void print_assignment | ( | SHELL_VAR * | var | ) |
Definition at line 1055 of file variables.c.
References array_p, assoc_p, function_p, variable::name, print_var_function(), print_var_value(), and var_isset.
Referenced by print_var_list().
void print_var_value | ( | SHELL_VAR * | var, |
int | quote | ||
) |
Definition at line 1086 of file variables.c.
References ansic_quote(), ansic_shouldquote(), free(), posixly_correct, sh_contains_shell_metas(), sh_single_quote(), t, value_cell, and var_isset.
Referenced by print_assignment(), and printenv_builtin().
void print_var_function | ( | SHELL_VAR * | var | ) |
Definition at line 1114 of file variables.c.
References FUNC_EXTERNAL, FUNC_MULTILINE, function_cell, function_p, named_function_string(), NULL, and var_isset.
Referenced by print_assignment(), print_func_list(), and printenv_builtin().
|
static |
Definition at line 1193 of file variables.c.
Referenced by init_funcname_var(), and initialize_dynamic_variables().
Definition at line 1217 of file variables.c.
References find_variable(), INIT_DYNAMIC_ARRAY_VAR, INIT_DYNAMIC_ASSOC_VAR, and VSETATTR.
Referenced by initialize_dynamic_variables().
|
static |
Definition at line 1269 of file variables.c.
References legal_number(), NOW, and shell_start_time.
Referenced by init_seconds_var().
Definition at line 1282 of file variables.c.
References att_integer, FREE, itos(), NOW, p, shell_start_time, value_cell, var_setvalue, and VSETATTR.
Referenced by init_seconds_var().
|
static |
Definition at line 1299 of file variables.c.
References assign_seconds(), find_variable(), get_seconds(), INIT_DYNAMIC_VAR, legal_number(), NULL, and value_cell.
Referenced by initialize_dynamic_variables().
|
static |
Definition at line 1324 of file variables.c.
Referenced by get_random_number().
|
static |
Definition at line 1346 of file variables.c.
Referenced by assign_random(), and seedrand().
|
static |
Definition at line 1354 of file variables.c.
References getpid(), NULL, and sbrand().
Referenced by get_random_number(), and initialize_shell_variables().
|
static |
Definition at line 1363 of file variables.c.
References getpid(), NULL, sbrand(), and subshell_environment.
Referenced by initialize_dynamic_variables().
int get_random_number | ( | ) |
Definition at line 1376 of file variables.c.
References brand(), getpid(), seedrand(), and subshell_environment.
Referenced by get_random().
Definition at line 1395 of file variables.c.
References att_integer, FREE, get_random_number(), itos(), p, value_cell, var_setvalue, and VSETATTR.
Referenced by initialize_dynamic_variables().
|
static |
Definition at line 1413 of file variables.c.
References legal_number(), line_number, and line_number_base.
Referenced by initialize_dynamic_variables().
Definition at line 1429 of file variables.c.
References executing_line_number(), FREE, itos(), p, value_cell, and var_setvalue.
Referenced by initialize_dynamic_variables().
|
static |
Definition at line 1443 of file variables.c.
References legal_number(), and subshell_level.
Referenced by initialize_dynamic_variables().
Definition at line 1458 of file variables.c.
References FREE, itos(), p, subshell_level, value_cell, and var_setvalue.
Referenced by initialize_dynamic_variables().
Definition at line 1470 of file variables.c.
References FREE, itos(), NOW, p, value_cell, and var_setvalue.
Referenced by initialize_dynamic_variables().
Definition at line 1485 of file variables.c.
References FREE, locale_decpoint(), NULL, p, savestring(), snprintf(), value_cell, and var_setvalue.
Referenced by initialize_dynamic_variables().
Definition at line 1504 of file variables.c.
References att_integer, FREE, getpid(), itos(), p, value_cell, var_setvalue, and VSETATTR.
Referenced by initialize_dynamic_variables().
Definition at line 1520 of file variables.c.
References dollar_vars, FREE, p, savestring(), value_cell, and var_setvalue.
Referenced by initialize_dynamic_variables().
|
static |
Definition at line 1534 of file variables.c.
References dollar_vars, FREE, savestring(), shell_name, static_shell_name, strcpy(), STRLEN, and xrealloc().
Referenced by initialize_dynamic_variables().
Definition at line 1558 of file variables.c.
References _(), aliases, array_cell, assoc_cell, assoc_create, bash_readline_initialized, bucket_contents::data, debugging_mode, dispose_words(), executable_file(), find_user_command(), free(), FREE, get_group_list(), HASH_ENTRIES, hash_items, hashed_filenames, i, init_bash_argv(), itos(), bucket_contents::key, legal_alias_name(), hash_table::nbuckets, bucket_contents::next, NULL, p, pathdata, perform_hostname_completion, phash_insert(), report_error(), rl_basic_word_break_characters, rl_completer_word_break_characters, savestring(), sh_notfound(), strchr(), the_printed_command_except_trap, value_cell, var_setarray, var_setvalue, variable_context, and xmalloc().
Referenced by initialize_dynamic_variables().
Definition at line 1834 of file variables.c.
References FREE, variable::name, savestring(), t, this_shell_function, value_cell, var_setvalue, and variable_context.
Referenced by init_funcname_var().
void make_funcname_visible | ( | int | on_or_off | ) |
Definition at line 1850 of file variables.c.
References att_invisible, variable::dynamic_value, find_variable(), VSETATTR, and VUNSETATTR.
Referenced by execute_function().
|
static |
Definition at line 1866 of file variables.c.
References att_invisible, att_noassign, find_variable(), get_funcname(), INIT_DYNAMIC_ARRAY_VAR, INIT_DYNAMIC_VAR, NULL, null_assign(), and VSETATTR.
Referenced by initialize_dynamic_variables().
|
static |
Definition at line 1883 of file variables.c.
References assign_bash_argv0(), assign_lineno(), assign_random(), assign_subshell(), att_integer, att_noassign, att_nofree, att_nounset, att_regenerate, get_bash_argv0(), get_bash_command(), get_bashpid(), get_epochrealtime(), get_epochseconds(), get_lineno(), get_random(), get_self(), get_subshell(), INIT_DYNAMIC_VAR, init_funcname_var(), init_seconds_var(), NULL, null_assign(), and VSETATTR.
Referenced by initialize_shell_variables().
|
static |
Definition at line 1950 of file variables.c.
References bucket_contents::data, hash_search(), and NULL.
Referenced by assign_in_env(), bind_tempenv_variable(), bind_variable(), bind_variable_internal(), find_function(), find_function_def(), find_nameref_at_context(), find_tempenv_variable(), find_variable_internal(), and var_lookup().
SHELL_VAR* var_lookup | ( | char * | name, |
VAR_CONTEXT * | vcontext | ||
) | const |
Definition at line 1965 of file variables.c.
References var_context::down, hash_lookup(), NULL, and var_context::table.
Referenced by find_global_variable(), find_global_variable_noref(), find_shell_variable(), find_variable_internal(), unbind_nameref(), unbind_variable(), and unbind_variable_noref().
SHELL_VAR* find_variable_internal | ( | char * | name, |
int | flags | ||
) | const |
Definition at line 1988 of file variables.c.
References var_context::down, variable::dynamic_value, expanding_redir, FV_FORCETEMPENV, FV_SKIPINVISIBLE, hash_lookup(), invisible_p, NULL, subshell_environment, var_context::table, and var_lookup().
Referenced by find_variable(), find_variable_for_assignment(), find_variable_last_nameref(), find_variable_nameref(), find_variable_no_invisible(), find_variable_noref(), find_variable_notempenv(), and find_variable_tempenv().
Definition at line 2038 of file variables.c.
References _(), assigning_in_environment, variable::context, executing_builtin, expanding_redir, find_global_variable_noref(), find_variable_internal(), flags, FV_FORCETEMPENV, internal_warning(), variable::name, nameref_cell, NAMEREF_MAX, nameref_p, and variable_context.
Referenced by find_global_variable(), find_shell_variable(), find_variable(), find_variable_for_assignment(), find_variable_no_invisible(), find_variable_notempenv(), find_variable_tempenv(), and unbind_variable().
SHELL_VAR* find_variable_last_nameref | ( | char * | name, |
int | vflags | ||
) | const |
Definition at line 2079 of file variables.c.
References assigning_in_environment, executing_builtin, expanding_redir, find_variable_internal(), find_variable_noref(), flags, FV_FORCETEMPENV, invisible_p, nameref_cell, NAMEREF_MAX, and nameref_p.
Referenced by assign_in_env(), bind_variable_internal(), execute_for_command(), find_variable_nameref_for_assignment(), find_variable_nameref_for_create(), nameref_transform_name(), param_expand(), parameter_brace_expand_indir(), parameter_brace_expand_word(), parameter_brace_find_indir(), and redir_varvalue().
SHELL_VAR* find_global_variable_last_nameref | ( | char * | name, |
int | vflags | ||
) | const |
Definition at line 2109 of file variables.c.
References find_global_variable_noref(), invisible_p, nameref_cell, NAMEREF_MAX, and nameref_p.
Referenced by nameref_transform_name().
|
static |
Definition at line 2135 of file variables.c.
References hash_lookup(), nameref_cell, NAMEREF_MAX, nameref_p, NULL, and var_context::table.
Referenced by find_variable_last_nameref_context(), and find_variable_nameref_context().
|
static |
Definition at line 2167 of file variables.c.
References var_context::down, find_nameref_at_context(), nameref_p, and NULL.
Referenced by bind_variable().
|
static |
Definition at line 2198 of file variables.c.
References var_context::down, find_nameref_at_context(), nameref_p, and NULL.
Referenced by bind_variable().
SHELL_VAR* find_variable_nameref_for_create | ( | char * | name, |
int | flags | ||
) | const |
Definition at line 2222 of file variables.c.
References _(), att_nameref, find_variable_last_nameref(), internal_warning(), INVALID_NAMEREF_VALUE, invisible_p, legal_identifier(), nameref_cell, nameref_p, sh_invalidid(), and VUNSETATTR.
Referenced by execute_in_subshell().
SHELL_VAR* find_variable_nameref_for_assignment | ( | char * | name, |
int | flags | ||
) | const |
Definition at line 2248 of file variables.c.
References _(), att_nameref, find_variable_last_nameref(), internal_warning(), INVALID_NAMEREF_VALUE, invisible_p, nameref_cell, nameref_p, sh_invalidid(), valid_nameref_value(), and VUNSETATTR.
char* nameref_transform_name | ( | char * | name, |
int | flags | ||
) |
Definition at line 2279 of file variables.c.
References ASS_CHKLOCAL, ASS_MKGLOBAL, ASS_MKLOCAL, variable::context, find_global_variable_last_nameref(), find_variable_last_nameref(), nameref_cell, nameref_p, valid_nameref_value(), and variable_context.
Referenced by strip_trailing_ifs_whitespace().
SHELL_VAR* find_variable_tempenv | ( | char * | name | ) | const |
Definition at line 2305 of file variables.c.
References find_variable_internal(), find_variable_nameref(), FV_FORCETEMPENV, and nameref_p.
Referenced by _find_user_command_internal(), and search_for_command().
SHELL_VAR* find_variable_notempenv | ( | char * | name | ) | const |
Definition at line 2318 of file variables.c.
References find_variable_internal(), find_variable_nameref(), and nameref_p.
SHELL_VAR* find_global_variable | ( | char * | name | ) | const |
Definition at line 2330 of file variables.c.
References variable::dynamic_value, find_variable_nameref(), nameref_p, NULL, and var_lookup().
Referenced by bind_variable_internal(), and strip_trailing_ifs_whitespace().
SHELL_VAR* find_global_variable_noref | ( | char * | name | ) | const |
Definition at line 2346 of file variables.c.
References variable::dynamic_value, NULL, and var_lookup().
Referenced by find_global_variable_last_nameref(), and find_variable_nameref().
SHELL_VAR* find_shell_variable | ( | char * | name | ) | const |
Definition at line 2360 of file variables.c.
References variable::dynamic_value, find_variable_nameref(), nameref_p, NULL, and var_lookup().
SHELL_VAR* find_variable | ( | char * | name | ) | const |
Definition at line 2377 of file variables.c.
References assigning_in_environment, executing_builtin, expanding_redir, find_variable_internal(), find_variable_nameref(), flags, FV_FORCETEMPENV, and nameref_p.
Referenced by assign_in_env(), bind_int_variable(), check_unbind_variable(), chkexport(), execute_for_command(), execute_function(), execute_in_subshell(), expr_bind_variable(), expr_streval(), get_name_for_error(), get_self(), get_string_value(), get_var_and_type(), init_funcname_var(), init_seconds_var(), initialize_shell_variables(), make_funcname_visible(), make_local_variable(), param_expand(), parameter_brace_expand_length(), parameter_brace_expand_word(), parameter_brace_transform(), printenv_builtin(), read_command(), redir_varvalue(), run_startup_files(), set_home_var(), set_if_not(), set_ppid(), set_pwd(), set_shell_var(), strip_trailing_ifs_whitespace(), strlong(), sv_funcnest(), sv_globignore(), sv_ifs(), sv_ignoreeof(), sv_locale(), sv_optind(), sv_shcompat(), sv_strict_posix(), sv_xtracefd(), uidset(), and unary_test().
SHELL_VAR* find_variable_no_invisible | ( | char * | name | ) | const |
Definition at line 2397 of file variables.c.
References assigning_in_environment, executing_builtin, expanding_redir, find_variable_internal(), find_variable_nameref(), flags, FV_FORCETEMPENV, FV_SKIPINVISIBLE, and nameref_p.
SHELL_VAR* find_variable_for_assignment | ( | char * | name | ) | const |
Definition at line 2416 of file variables.c.
References assigning_in_environment, executing_builtin, expanding_redir, find_variable_internal(), find_variable_nameref(), flags, FV_FORCETEMPENV, and nameref_p.
SHELL_VAR* find_variable_noref | ( | char * | name | ) | const |
Definition at line 2433 of file variables.c.
References assigning_in_environment, executing_builtin, expanding_redir, find_variable_internal(), flags, and FV_FORCETEMPENV.
Referenced by bind_variable_internal(), find_variable_last_nameref(), make_local_variable(), and unary_test().
SHELL_VAR* find_function | ( | char * | name | ) | const |
Definition at line 2449 of file variables.c.
References hash_lookup().
Referenced by bind_function(), execute_disk_command(), execute_intern_function(), execute_simple_command(), expand_word_list_internal(), initialize_shell_variables(), and set_var_read_only().
FUNCTION_DEF* find_function_def | ( | char * | name | ) | const |
Definition at line 2458 of file variables.c.
References hash_lookup().
Referenced by bind_function(), and execute_function().
char* get_variable_value | ( | SHELL_VAR * | var | ) |
Definition at line 2471 of file variables.c.
References array_cell, array_p, assoc_cell, assoc_p, NULL, and value_cell.
Referenced by expr_streval(), get_string_value(), make_variable_value(), redir_varvalue(), and sv_optind().
char* get_string_value | ( | char * | var_name | ) | const |
Definition at line 2492 of file variables.c.
References find_variable(), get_variable_value(), and NULL.
Referenced by adjust_shell_level(), bash_special_tilde_expansions(), check_mail(), current_working_directory(), default_columns(), execute_command_internal(), execute_for_command(), execute_prompt_command(), execute_simple_command(), get_bash_name(), get_locale_var(), get_tmpdir(), indirection_level_string(), job_working_directory(), main(), polite_directory_format(), remember_mail_dates(), run_startup_files(), send_pwd_to_eterm(), set_default_lang(), set_default_locale_vars(), setup_glob_ignore(), setup_ignore_patterns(), sh_get_env_value(), sh_makepath(), strftime(), strlong(), sv_globignore(), sv_locale(), sv_opterr(), sv_shcompat(), time_to_check_mail(), trim_pathname(), user_command_matches(), and yyparse().
char* sh_get_env_value | ( | char * | v | ) | const |
Definition at line 2503 of file variables.c.
References get_string_value().
int validate_inherited_value | ( | SHELL_VAR * | var, |
int | type | ||
) |
SHELL_VAR* set_if_not | ( | char * | name, |
char * | value | ||
) |
Definition at line 2553 of file variables.c.
References bind_variable_internal(), create_variable_tables(), find_variable(), HASH_NOSRCH, and var_context::table.
Referenced by initialize_shell_variables(), and set_machine_vars().
SHELL_VAR* make_local_variable | ( | char * | name, |
int | flags | ||
) | const |
Definition at line 2569 of file variables.c.
References _(), array_cell, array_p, variable::assign_func, assoc_cell, assoc_copy, assoc_p, att_exported, att_invisible, att_local, att_nameref, variable::attributes, builtin_error(), variable::context, var_context::down, variable::dynamic_value, exported_p, find_variable(), find_variable_noref(), var_context::flags, hash_create(), ifsname, internal_error(), local_p, localvar_inherit, make_new_variable(), MKLOC_INHERIT, nameref_p, no_invisible_vars, noassign_p, NULL, readonly_p, savestring(), var_context::scope, setifs(), sh_readonly(), var_context::table, TEMPENV_HASH_BUCKETS, tempvar_p, value_cell, var_setarray, var_setassoc, var_setvalue, variable_context, VC_HASLOCAL, vc_isfuncenv, VSETATTR, and VUNSETATTR.
Referenced by make_new_variable().
|
static |
Definition at line 2714 of file variables.c.
References variable::assign_func, variable::attributes, CLEAR_EXPORTSTR, variable::context, variable::dynamic_value, variable::name, NULL, savestring(), var_setvalue, and xmalloc().
Referenced by bind_function(), and make_new_variable().
|
static |
Definition at line 2741 of file variables.c.
References array_create(), array_p, assoc_create, assoc_p, att_array, att_assoc, create_variable_tables(), bucket_contents::data, dispose_variable_value(), hash_insert(), HASH_NOSRCH, internal_warning(), localvar_inherit, make_local_variable(), new_shell_variable(), PTR_T, savestring(), var_context::table, var_setarray, var_setassoc, VSETATTR, and VUNSETATTR.
Referenced by assign_in_env(), bind_variable_internal(), and make_local_variable().
char* make_variable_value | ( | SHELL_VAR * | var, |
char * | value, | ||
int | flags | ||
) |
Definition at line 2869 of file variables.c.
References ASS_APPEND, ASS_NOEVAL, ASS_NOLONGJMP, capcase_p, CASE_CAPITALIZE, CASE_LOWER, CASE_UPPER, DISCARD, evalexp(), free(), get_variable_value(), integer_p, itos(), jump_to_top_level(), lowercase_p, NULL, savestring(), sh_modcase(), strcpy(), STRLEN, top_level_cleanup(), uppercase_p, value_cell, and xmalloc().
Referenced by assign_in_env(), bind_variable_internal(), and bind_variable_value().
|
static |
Definition at line 2978 of file variables.c.
References array_p, ASS_APPEND, assoc_p, capcase_p, integer_p, lowercase_p, noassign_p, readonly_p, and uppercase_p.
Referenced by bind_variable_internal().
Definition at line 2998 of file variables.c.
References strcpy(), STRLEN, value_cell, var_setvalue, and xrealloc().
Referenced by bind_variable_internal().
|
static |
Definition at line 3026 of file variables.c.
References _(), array_cell, array_needs_making, array_p, ASS_APPEND, ASS_FORCE, ASS_NAMEREF, variable::assign_func, assoc_cell, assoc_p, att_exported, att_invisible, att_nameref, can_optimize_assignment(), err_readonly(), exported_p, find_global_variable(), find_variable_last_nameref(), find_variable_noref(), free(), FREE, hash_lookup(), HASH_NOSRCH, internal_warning(), INVALIDATE_EXPORTSTR, invisible_p, make_new_variable(), make_variable_value(), mark_modified_vars, variable::name, name_cell, nameref_cell, nameref_p, noassign_p, NULL, optimized_assignment(), readonly_p, savestring(), sh_invalidid(), var_context::table, valid_nameref_value(), value_cell, var_setvalue, VSETATTR, and VUNSETATTR.
Referenced by bind_global_variable(), bind_invalid_envvar(), bind_variable(), push_exported_var(), push_posix_temp_var(), push_posix_tempvar_internal(), push_temp_var(), and set_if_not().
SHELL_VAR* bind_variable | ( | char * | name, |
char * | value, | ||
int | flags | ||
) | const |
Definition at line 3188 of file variables.c.
References _(), ASS_NAMEREF, bind_tempenv_variable(), bind_variable_internal(), bind_variable_value(), create_variable_tables(), var_context::down, find_variable_last_nameref_context(), find_variable_nameref_context(), hash_lookup(), internal_warning(), variable::name, nameref_cell, nameref_p, var_context::table, vc_isbltnenv, and vc_isfuncenv.
Referenced by adjust_shell_level(), bind_int_variable(), bind_lastarg(), check_mail(), do_assignment_internal(), execute_for_command(), execute_in_subshell(), initialize_shell_variables(), main(), parameter_brace_expand_rhs(), run_startup_files(), set_home_var(), set_ppid(), set_pwd(), set_shell_var(), sh_set_lines_and_columns(), strlong(), uidset(), and yyparse().
SHELL_VAR* bind_global_variable | ( | char * | name, |
char * | value, | ||
int | flags | ||
) | const |
Definition at line 3267 of file variables.c.
References bind_variable_internal(), create_variable_tables(), and var_context::table.
|
static |
Definition at line 3280 of file variables.c.
References bind_variable_internal(), hash_create(), and HASH_NOSRCH.
Referenced by initialize_shell_variables().
Definition at line 3296 of file variables.c.
References _(), array_needs_making, ASS_APPEND, ASS_FORCE, ASS_NAMEREF, variable::assign_func, att_exported, att_invisible, check_selfref(), exported_p, free(), FREE, internal_error(), internal_warning(), INVALIDATE_EXPORTSTR, invisible_p, make_variable_value(), mark_modified_vars, name_cell, NULL, t, valid_nameref_value(), value_cell, var_setvalue, variable_context, VSETATTR, and VUNSETATTR.
Referenced by bind_variable(), and execute_for_command().
SHELL_VAR* bind_int_variable | ( | char * | lhs, |
char * | rhs, | ||
int | flags | ||
) |
Definition at line 3365 of file variables.c.
References _(), array_p, ASS_NOEXPAND, att_integer, att_invisible, bind_variable(), find_variable(), integer_p, internal_warning(), legal_identifier(), nameref_p, NULL, sh_invalidid(), VSETATTR, and VUNSETATTR.
Referenced by bind_var_to_int(), and expr_bind_variable().
SHELL_VAR* bind_var_to_int | ( | char * | var, |
intmax_t | val | ||
) |
Definition at line 3421 of file variables.c.
References bind_int_variable(), fmtulong(), INT_STRLEN_BOUND, and p.
Referenced by redir_varassign().
Definition at line 3434 of file variables.c.
References array_needs_making, att_exported, att_function, att_invisible, function_def::command, copy_command(), copy_function_def(), copy_function_def_contents(), bucket_contents::data, dispose_command(), dispose_function_def_contents(), exported_p, find_function(), find_function_def(), flags, function_cell, hash_insert(), HASH_NOSRCH, INVALIDATE_EXPORTSTR, it_functions, mark_modified_vars, new_shell_variable(), PTR_T, savestring(), var_isset, var_setfunc, VSETATTR, and VUNSETATTR.
Referenced by execute_intern_function().
int assign_in_env | ( | WORD_DESC * | word, |
int | flags | ||
) |
Definition at line 3518 of file variables.c.
References array_cell, array_needs_making, array_p, ASS_APPEND, variable::assign_func, assignment(), assoc_cell, assoc_copy, assoc_p, att_exported, att_tempvar, variable::attributes, variable::context, copy_command(), COPY_EXPORTSTR, variable::dynamic_value, echo_command_at_execute, err_readonly(), expand_assignment_string_to_string(), variable::exportstr, find_variable(), find_variable_last_nameref(), free(), FREE, function_cell, function_p, hash_create(), hash_lookup(), INVALIDATE_EXPORTSTR, legal_identifier(), make_new_variable(), make_variable_value(), mk_env_string(), variable::name, name_cell, nameref_cell, nameref_p, noassign_p, NULL, readonly_p, savestring(), sh_invalidid(), string, stupidly_hack_special_variables(), temp, TEMPENV_HASH_BUCKETS, valid_nameref_value(), value_cell, var_setarray, var_setassoc, var_setfunc, var_setref, var_setvalue, variable_context, word_desc::word, xmalloc(), and xtrace_print_assignment().
Referenced by expand_word_list_internal().
|
static |
Definition at line 3684 of file variables.c.
References array_cell, array_p, assoc_cell, assoc_p, dispose_command(), FREE, function_cell, function_p, nameref_cell, nameref_p, and value_cell.
Referenced by dispose_variable(), and make_new_variable().
void dispose_variable | ( | SHELL_VAR * | var | ) |
Definition at line 3702 of file variables.c.
References array_needs_making, dispose_variable_value(), exported_p, free(), FREE_EXPORTSTR, variable::name, and nofree_p.
Referenced by delete_var(), execute_for_command(), free_variable_hash_data(), makunbound(), propagate_temp_var(), push_exported_var(), push_posix_temp_var(), push_posix_tempvar_internal(), push_temp_var(), and unbind_func().
int unbind_variable | ( | char * | name | ) | const |
Definition at line 3724 of file variables.c.
References find_variable_nameref(), makunbound(), variable::name, nameref_p, NULL, and var_lookup().
Referenced by check_mail(), check_unbind_variable(), enable_mypid_builtin_unload(), execute_for_command(), execute_in_subshell(), main(), and stat_builtin().
int unbind_nameref | ( | char * | name | ) | const |
Definition at line 3739 of file variables.c.
References makunbound(), nameref_p, and var_lookup().
int unbind_variable_noref | ( | char * | name | ) | const |
Definition at line 3752 of file variables.c.
References makunbound(), and var_lookup().
Referenced by execute_in_subshell(), and uidset().
int check_unbind_variable | ( | char * | name | ) | const |
Definition at line 3764 of file variables.c.
References _(), find_variable(), internal_error(), readonly_p, and unbind_variable().
Referenced by execute_in_subshell().
int unbind_func | ( | char * | name | ) | const |
Definition at line 3780 of file variables.c.
References array_needs_making, bucket_contents::data, dispose_function_def(), dispose_variable(), exported_p, free(), hash_remove(), if(), it_functions, and bucket_contents::key.
int delete_var | ( | char * | name, |
VAR_CONTEXT * | vc | ||
) | const |
Definition at line 3834 of file variables.c.
References bucket_contents::data, dispose_variable(), var_context::down, free(), hash_remove(), bucket_contents::key, NULL, and var_context::table.
int makunbound | ( | char * | name, |
VAR_CONTEXT * | vc | ||
) | const |
Definition at line 3862 of file variables.c.
References array_cell, array_needs_making, array_p, assoc_cell, assoc_p, att_exported, att_invisible, att_local, variable::attributes, variable::context, bucket_contents::data, dispose_variable(), var_context::down, exported_p, free(), FREE, hash_insert(), hash_remove(), if(), INVALIDATE_EXPORTSTR, bucket_contents::key, local_p, localvar_unset, variable::name, nameref_cell, nameref_p, nofree_p, NULL, PTR_T, savestring(), stupidly_hack_special_variables(), t, var_context::table, tempvar_p, value_cell, var_setvalue, variable_context, and VSETATTR.
Referenced by unbind_nameref(), unbind_variable(), and unbind_variable_noref().
void kill_all_local_variables | ( | ) |
Definition at line 3939 of file variables.c.
References delete_all_variables(), var_context::down, hash_dispose(), NULL, var_context::scope, var_context::table, variable_context, vc_haslocals, and vc_isfuncenv.
|
static |
Definition at line 3958 of file variables.c.
References dispose_variable().
Referenced by delete_all_variables(), and flush_temporary_env().
void delete_all_variables | ( | HASH_TABLE * | hashed_vars | ) |
Definition at line 3969 of file variables.c.
References free_variable_hash_data(), and hash_flush().
Referenced by delete_all_contexts(), dispose_var_context(), kill_all_local_variables(), and shell_reinitialize().
void set_var_read_only | ( | char * | name | ) |
Definition at line 3996 of file variables.c.
References att_readonly, find_function(), FIND_OR_MAKE_VARIABLE, set_auto_export, and VSETATTR.
Referenced by run_startup_files().
|
static |
Definition at line 4051 of file variables.c.
References _vlist::list, _vlist::list_len, _vlist::list_size, NULL, and xmalloc().
Referenced by all_local_variables(), map_over(), map_over_funcs(), and vlist_realloc().
Definition at line 4066 of file variables.c.
References _vlist::list, _vlist::list_size, n, vlist_alloc(), and xrealloc().
Referenced by vlist_add().
Definition at line 4081 of file variables.c.
References i, _vlist::list, _vlist::list_len, _vlist::list_size, variable::name, NULL, STREQ, and vlist_realloc().
Referenced by flatten().
SHELL_VAR** map_over | ( | sh_var_map_func_t * | function, |
VAR_CONTEXT * | vc | ||
) |
Definition at line 4105 of file variables.c.
References var_context::down, flatten(), free(), HASH_ENTRIES, _vlist::list, NULL, var_context::table, and vlist_alloc().
Referenced by make_var_export_array(), and vapply().
SHELL_VAR** map_over_funcs | ( | sh_var_map_func_t * | function | ) |
Definition at line 4131 of file variables.c.
References flatten(), free(), HASH_ENTRIES, _vlist::list, NULL, and vlist_alloc().
Referenced by fapply(), and make_func_export_array().
|
static |
Definition at line 4156 of file variables.c.
References bucket_contents::data, HASH_ENTRIES, hash_items, i, hash_table::nbuckets, bucket_contents::next, and vlist_add().
Referenced by all_local_variables(), map_over(), map_over_funcs(), and push_var_context().
void sort_variables | ( | SHELL_VAR ** | array | ) |
Definition at line 4184 of file variables.c.
References qsort(), qsort_var_comp(), and strvec_len().
Referenced by all_local_variables(), fapply(), and vapply().
Definition at line 4191 of file variables.c.
Referenced by sort_variables().
|
static |
Definition at line 4205 of file variables.c.
References list, map_over(), and sort_variables().
Referenced by all_exported_variables(), all_local_variables(), all_shell_variables(), all_visible_variables(), and local_exported_variables().
|
static |
Definition at line 4219 of file variables.c.
References list, map_over_funcs(), and sort_variables().
Referenced by all_shell_functions(), and all_visible_functions().
SHELL_VAR** all_shell_variables | ( | ) |
Definition at line 4232 of file variables.c.
References NULL, and vapply().
SHELL_VAR** all_shell_functions | ( | ) |
Definition at line 4239 of file variables.c.
References fapply(), and NULL.
|
static |
Definition at line 4245 of file variables.c.
References invisible_p.
Referenced by all_visible_functions(), and all_visible_variables().
SHELL_VAR** all_visible_functions | ( | ) |
Definition at line 4252 of file variables.c.
References fapply(), and visible_var().
SHELL_VAR** all_visible_variables | ( | ) |
Definition at line 4258 of file variables.c.
References vapply(), and visible_var().
Referenced by all_variables_matching_prefix().
|
static |
Definition at line 4266 of file variables.c.
References exported_p, and invisible_p.
Referenced by all_exported_variables(), make_func_export_array(), and make_var_export_array().
|
static |
Definition at line 4276 of file variables.c.
References exported_p, imported_p, and invisible_p.
Referenced by make_var_export_array().
|
static |
Definition at line 4285 of file variables.c.
References variable::context, exported_p, invisible_p, local_p, and variable_context.
Referenced by local_exported_variables().
SHELL_VAR** all_exported_variables | ( | ) |
Definition at line 4292 of file variables.c.
References vapply(), and visible_and_exported().
SHELL_VAR** local_exported_variables | ( | ) |
Definition at line 4298 of file variables.c.
References local_and_exported(), and vapply().
|
static |
Definition at line 4304 of file variables.c.
References variable::context, invisible_p, local_p, and variable_context.
Referenced by all_local_variables().
SHELL_VAR** all_local_variables | ( | ) |
Definition at line 4311 of file variables.c.
References _(), array_p, assoc_p, var_context::down, flatten(), free(), HASH_ENTRIES, internal_error(), invisible_p, _vlist::list, NULL, var_context::scope, shell_variables, sort_variables(), var_context::table, vapply(), variable_context, variable_in_context(), vc_haslocals, vc_isfuncenv, and vlist_alloc().
char** all_variables_matching_prefix | ( | char * | prefix | ) | const |
Definition at line 4358 of file variables.c.
References all_visible_variables(), free(), NULL, savestring(), STREQN, STRLEN, and strvec_create().
Referenced by parameter_brace_expand().
|
static |
Definition at line 4391 of file variables.c.
References FREE, hash_lookup(), INVALIDATE_EXPORTSTR, NULL, savestring(), value_cell, and var_setvalue.
Referenced by bind_variable().
SHELL_VAR* find_tempenv_variable | ( | char * | name | ) | const |
Definition at line 4412 of file variables.c.
References hash_lookup(), and NULL.
|
static |
Definition at line 4426 of file variables.c.
References ASS_FORCE, ASS_NOLONGJMP, att_propagate, att_tempvar, variable::attributes, bind_variable_internal(), dispose_variable(), find_special_var(), hash_create(), variable::name, savestring(), var_context::table, value_cell, and VARIABLES_HASH_BUCKETS.
Referenced by merge_temporary_env().
|
static |
Definition at line 4462 of file variables.c.
References ASS_FORCE, ASS_NOLONGJMP, att_propagate, att_tempvar, variable::attributes, bind_variable_internal(), variable::context, dispose_variable(), find_special_var(), var_context::flags, hash_create(), variable::name, savestring(), var_context::scope, var_context::table, TEMPENV_HASH_BUCKETS, value_cell, VARIABLES_HASH_BUCKETS, and VC_HASTMPVAR.
Referenced by merge_temporary_env(), and propagate_temp_var().
|
static |
Definition at line 4509 of file variables.c.
References att_propagate, variable::attributes, dispose_variable(), find_special_var(), variable::name, push_temp_var(), savestring(), and tempvar_p.
Referenced by dispose_used_env_vars().
|
static |
Definition at line 4533 of file variables.c.
References array_needs_making, hash_dispose(), HASH_ENTRIES, hash_flush(), i, NULL, strvec_create(), strvec_dispose(), stupidly_hack_special_variables(), and tvlist_ind.
Referenced by dispose_used_env_vars(), and merge_temporary_env().
void dispose_used_env_vars | ( | ) |
Definition at line 4558 of file variables.c.
References dispose_temporary_env(), maybe_make_export_env(), and propagate_temp_var().
Referenced by execute_command_internal(), and reader_loop().
void merge_temporary_env | ( | ) |
Definition at line 4573 of file variables.c.
References dispose_temporary_env(), posixly_correct, push_posix_temp_var(), and push_temp_var().
Referenced by execute_builtin(), execute_simple_command(), and push_var_context().
void flush_temporary_env | ( | ) |
Definition at line 4580 of file variables.c.
References free_variable_hash_data(), hash_dispose(), hash_flush(), and NULL.
Referenced by command_substitute(), and parameter_brace_remove_pattern().
|
inlinestatic |
Definition at line 4597 of file variables.c.
References _(), BASHFUNC_PREFIX, BASHFUNC_PREFLEN, BASHFUNC_SUFFIX, BASHFUNC_SUFFLEN, dequote_escapes(), variable::exportstr, free(), internal_error(), legal_variable_char, legal_variable_starter, p, STRLEN, t, and xmalloc().
Referenced by assign_in_env(), and make_env_array_from_var_list().
|
static |
Definition at line 4685 of file variables.c.
References array_cell, array_p, assoc_cell, assoc_p, variable::dynamic_value, variable::exportstr, free(), function_cell, function_p, i, INVALIDATE_EXPORTSTR, list, mk_env_string(), variable::name, named_function_string(), NULL, regen_p, SAVE_EXPORTSTR, savestring(), strvec_create(), strvec_len(), USE_EXPORTSTR, and value_cell.
Referenced by make_func_export_array(), and make_var_export_array().
|
static |
Definition at line 4761 of file variables.c.
References export_environment_candidate(), free(), list, make_env_array_from_var_list(), map_over(), NULL, and visible_and_exported().
Referenced by maybe_make_export_env().
|
static |
Definition at line 4783 of file variables.c.
References free(), list, make_env_array_from_var_list(), map_over_funcs(), NULL, and visible_and_exported().
Referenced by maybe_make_export_env().
char** add_or_supercede_exported_var | ( | char * | assign, |
int | do_alloc | ||
) |
Definition at line 4815 of file variables.c.
References add_to_export_env, assignment(), export_env, export_env_index, free(), i, savestring(), and STREQN.
Referenced by add_temp_array_to_env(), and update_export_env_inplace().
|
static |
Definition at line 4847 of file variables.c.
References add_or_supercede_exported_var(), add_to_export_env, export_env, free(), and i.
Referenced by maybe_make_export_env().
|
static |
Definition at line 4884 of file variables.c.
References var_context::down, HASH_ENTRIES, n, and var_context::table.
Referenced by maybe_make_export_env().
int chkexport | ( | char * | name | ) |
Definition at line 4895 of file variables.c.
References array_needs_making, exported_p, find_variable(), and maybe_make_export_env().
Referenced by sv_globignore().
void maybe_make_export_env | ( | ) |
Definition at line 4911 of file variables.c.
References add_temp_array_to_env(), array_needs_making, var_context::down, environ, export_env, export_env_index, export_env_size, free(), HASH_ENTRIES, invalid_env, make_func_export_array(), make_var_export_array(), n_shell_variables(), new_var_context(), NULL, shell_variables, strvec_flush(), strvec_resize(), var_context::table, and temporary_env.
Referenced by chkexport(), command_substitute(), dispose_used_env_vars(), execute_disk_command(), execute_simple_command(), execute_subshell_builtin_or_function(), printenv_builtin(), reset_locale_vars(), and sv_globignore().
void update_export_env_inplace | ( | char * | env_prefix, |
int | preflen, | ||
char * | value | ||
) |
Definition at line 4991 of file variables.c.
References add_or_supercede_exported_var(), export_env, strcpy(), STRLEN, and xmalloc().
Referenced by put_command_name_into_env().
void put_command_name_into_env | ( | char * | command_name | ) |
Definition at line 5007 of file variables.c.
References update_export_env_inplace().
Referenced by execute_disk_command().
VAR_CONTEXT* new_var_context | ( | char * | name, |
int | flags | ||
) |
Definition at line 5023 of file variables.c.
References var_context::down, var_context::flags, flags, var_context::name, NULL, savestring(), var_context::scope, var_context::table, var_context::up, variable_context, and xmalloc().
Referenced by create_variable_tables(), maybe_make_export_env(), and push_var_context().
void dispose_var_context | ( | VAR_CONTEXT * | vc | ) |
Definition at line 5043 of file variables.c.
References delete_all_variables(), free(), FREE, hash_dispose(), var_context::name, and var_context::table.
Referenced by delete_all_contexts(), and pop_var_context().
|
static |
Definition at line 5059 of file variables.c.
References variable::context, and variable_context.
Referenced by push_var_context().
VAR_CONTEXT* push_var_context | ( | char * | name, |
int | flags, | ||
HASH_TABLE * | tempvars | ||
) |
Definition at line 5069 of file variables.c.
References var_context::down, var_context::flags, flatten(), merge_temporary_env(), new_var_context(), NULL, posixly_correct, set_context(), shell_variables, var_context::table, var_context::up, VC_FUNCENV, and VC_HASTMPVAR.
Referenced by push_context(), and push_scope().
|
inlinestatic |
Definition at line 5119 of file variables.c.
References array_cell, array_p, assoc_cell, assoc_copy, assoc_p, att_propagate, att_tempvar, variable::attributes, bind_variable_internal(), variable::context, dispose_variable(), var_context::flags, FREE, hash_create(), local_p, variable::name, posixly_correct, var_context::scope, STREQ, stupidly_hack_special_variables(), var_context::table, tempvar_p, value_cell, var_setarray, var_setassoc, VARIABLES_HASH_BUCKETS, VC_HASTMPVAR, vc_isfuncenv, and vc_istempenv.
Referenced by push_builtin_var(), and push_func_var().
|
static |
Definition at line 5173 of file variables.c.
References push_posix_tempvar_internal().
Referenced by pop_var_context().
|
static |
Definition at line 5183 of file variables.c.
References push_posix_tempvar_internal().
Referenced by pop_scope().
void pop_var_context | ( | ) |
Definition at line 5195 of file variables.c.
References _(), dispose_var_context(), var_context::down, hash_flush(), internal_error(), NULL, push_func_var(), shell_variables, var_context::table, var_context::up, and vc_isfuncenv.
Referenced by pop_context().
void delete_all_contexts | ( | VAR_CONTEXT * | vcxt | ) |
Definition at line 5221 of file variables.c.
References delete_all_variables(), dispose_var_context(), var_context::down, global_variables, t, and var_context::table.
Referenced by shell_reinitialize().
VAR_CONTEXT* push_scope | ( | int | flags, |
HASH_TABLE * | tmpvars | ||
) |
Definition at line 5243 of file variables.c.
References NULL, and push_var_context().
Referenced by execute_builtin().
|
static |
Definition at line 5251 of file variables.c.
References att_propagate, att_tempvar, variable::attributes, bind_variable_internal(), variable::context, dispose_variable(), exported_p, variable::name, var_context::scope, stupidly_hack_special_variables(), var_context::table, tempvar_p, and value_cell.
Referenced by pop_scope().
void pop_scope | ( | int | is_special | ) |
Definition at line 5286 of file variables.c.
References _(), var_context::down, free(), FREE, hash_dispose(), hash_flush(), internal_error(), var_context::name, NULL, push_builtin_var(), push_exported_var(), shell_variables, sv_ifs(), var_context::table, var_context::up, vc_isbltnenv, and vc_istempscope.
Referenced by execute_builtin().
|
static |
Definition at line 5340 of file variables.c.
References dollar_vars, i, NULL, and strvec_create().
Referenced by push_dollar_vars().
|
static |
Definition at line 5355 of file variables.c.
References dollar_vars, and i.
Referenced by pop_dollar_vars().
|
static |
Definition at line 5365 of file variables.c.
References dollar_vars, FREE, i, and NULL.
Referenced by pop_dollar_vars().
|
static |
Definition at line 5377 of file variables.c.
Referenced by dispose_saved_dollar_vars().
void push_context | ( | char * | name, |
int | is_subshell, | ||
HASH_TABLE * | tempvars | ||
) |
Definition at line 5388 of file variables.c.
References push_dollar_vars(), push_var_context(), variable_context, and VC_FUNCENV.
Referenced by execute_function().
void pop_context | ( | ) |
Definition at line 5402 of file variables.c.
References pop_dollar_vars(), pop_var_context(), sv_ifs(), and variable_context.
Referenced by execute_function().
void push_dollar_vars | ( | ) |
Definition at line 5413 of file variables.c.
References dollar_arg_stack_index, saved_dollar_vars::first_ten, NULL, saved_dollar_vars::rest, rest_of_args, save_dollar_vars(), and xrealloc().
Referenced by push_context().
void pop_dollar_vars | ( | ) |
Definition at line 5432 of file variables.c.
References dispose_words(), dollar_arg_stack_index, saved_dollar_vars::first_ten, free(), free_dollar_vars(), invalidate_cached_quoted_dollar_at(), NULL, saved_dollar_vars::rest, restore_dollar_vars(), and set_dollar_vars_unchanged().
Referenced by pop_context().
void dispose_saved_dollar_vars | ( | ) |
Definition at line 5453 of file variables.c.
References dispose_words(), dollar_arg_stack_index, saved_dollar_vars::first_ten, free(), free_saved_dollar_vars(), NULL, and saved_dollar_vars::rest.
void init_bash_argv | ( | ) |
Definition at line 5469 of file variables.c.
References bash_argv_initialized, and save_bash_argv().
Referenced by _evalfile(), execute_function(), and get_bash_command().
void save_bash_argv | ( | ) |
Definition at line 5479 of file variables.c.
References dispose_words(), list, list_rest_of_args(), and push_args().
Referenced by init_bash_argv().
void push_args | ( | WORD_LIST * | list | ) |
Definition at line 5491 of file variables.c.
References array_push, free(), GET_ARRAY_FROM_VAR, i, itos(), word_list::next, t, word_desc::word, and word_list::word.
Referenced by bind_args(), execute_function(), and save_bash_argv().
void pop_args | ( | ) |
Definition at line 5517 of file variables.c.
References array_pop, element_value, GET_ARRAY_FROM_VAR, i, and legal_number().
Referenced by _evalfile(), execute_function(), and unbind_args().
|
static |
Definition at line 5646 of file variables.c.
References name_and_function::name.
Referenced by stupidly_hack_special_variables().
|
inlinestatic |
Definition at line 5657 of file variables.c.
References i, and name_and_function::name.
Referenced by propagate_temp_var(), push_posix_temp_var(), push_temp_var(), and stupidly_hack_special_variables().
void stupidly_hack_special_variables | ( | char * | name | ) |
Definition at line 5680 of file variables.c.
References find_special_var(), name_and_function::function, i, N_SPECIAL_VARS, name_and_function::name, qsort(), and sv_compare().
Referenced by assign_in_env(), dispose_temporary_env(), do_assignment_internal(), expr_bind_variable(), makunbound(), parameter_brace_expand_rhs(), push_exported_var(), push_posix_tempvar_internal(), redir_varassign(), and run_startup_files().
void reinit_special_variables | ( | ) |
Definition at line 5701 of file variables.c.
References sv_globignore(), and sv_opterr().
Referenced by shell_reinitialize().
void sv_ifs | ( | char * | name | ) |
Definition at line 5711 of file variables.c.
References find_variable(), and setifs().
Referenced by pop_context(), pop_scope(), redirection_expand(), write_here_document(), and write_here_string().
void sv_path | ( | char * | name | ) |
Definition at line 5722 of file variables.c.
References phash_flush().
void sv_mail | ( | char * | name | ) |
Definition at line 5733 of file variables.c.
References free_mail_files(), remember_mail_dates(), and reset_mail_timer().
void sv_funcnest | ( | char * | name | ) |
Definition at line 5750 of file variables.c.
References find_variable(), funcnest_max, legal_number(), and value_cell.
Referenced by initialize_shell_variables().
void sv_execignore | ( | char * | name | ) |
Definition at line 5767 of file variables.c.
References setup_exec_ignore().
void sv_globignore | ( | char * | name | ) |
Definition at line 5775 of file variables.c.
References array_needs_making, chkexport(), extract_colon_unit(), find_variable(), free(), get_string_value(), HC_ERASEDUPS, HC_IGNBOTH, HC_IGNDUPS, HC_IGNSPACE, history_comment_char, history_control, history_expansion_char, history_lines_in_file, history_lines_this_session, history_subst_char, history_truncate_file(), history_write_timestamps, hostname_list_initialized, interactive_shell, legal_number(), maybe_make_export_env(), name_and_function::name, no_line_editing, posixly_correct, privileged_mode, rl_reset_screen_size(), rl_reset_terminal(), rl_set_screen_size(), setup_glob_ignore(), stifle_history(), STREQ, sv_histsize(), temp, tzset(), unstifle_history(), val, value_cell, var_isset, and where_history().
Referenced by reinit_special_variables().
void sv_ignoreeof | ( | char * | name | ) |
Definition at line 6005 of file variables.c.
References all_digits(), atoi(), eof_encountered, eof_encountered_limit, find_variable(), ignoreeof, NULL, temp, value_cell, and var_isset.
Referenced by initialize_shell_variables().
void sv_optind | ( | char * | name | ) |
Definition at line 6022 of file variables.c.
References atoi(), find_variable(), get_variable_value(), and NULL.
void sv_opterr | ( | char * | name | ) |
Definition at line 6050 of file variables.c.
References atoi(), get_string_value(), and sh_opterr.
Referenced by reinit_special_variables().
void sv_strict_posix | ( | char * | name | ) |
Definition at line 6060 of file variables.c.
References find_variable(), interactive_shell, posix_initialize(), posixly_correct, and var_isset.
Referenced by initialize_shell_variables(), and main().
void sv_locale | ( | char * | name | ) |
Definition at line 6076 of file variables.c.
References array_cell, array_num_elements, array_p, element_forw, element_value, find_variable(), free(), get_string_value(), i, INT_STRLEN_BOUND, inttostr(), itos(), last_command_exit_value, NULL, posixly_correct, set_element_value, set_lang(), set_locale_var(), t, and var_setarray.
void set_pipestatus_from_exit | ( | int | s | ) |
Definition at line 6194 of file variables.c.
Referenced by execute_command_internal(), execute_simple_command(), and exp_jump_to_top_level().
void sv_xtracefd | ( | char * | name | ) |
Definition at line 6206 of file variables.c.
References _(), find_variable(), internal_error(), sh_validfd(), strtol(), t, value_cell, xtrace_reset(), and xtrace_set().
Referenced by initialize_shell_variables().
void sv_shcompat | ( | char * | name | ) |
Definition at line 6243 of file variables.c.
References _(), atoi(), find_variable(), get_string_value(), internal_error(), ISDIGIT, name_and_function::name, set_maxchild(), shell_compatibility_level, val, and value_cell.
Referenced by initialize_shell_variables().
char** environ |
Referenced by maybe_make_export_env().
time_t shell_start_time |
Definition at line 181 of file shell.c.
Referenced by assign_seconds(), and get_seconds().
VAR_CONTEXT* global_variables = (VAR_CONTEXT *) 0x0 |
Definition at line 104 of file variables.c.
Referenced by delete_all_contexts().
VAR_CONTEXT* shell_variables = (VAR_CONTEXT *) 0x0 |
Definition at line 107 of file variables.c.
Referenced by all_local_variables(), initialize_subshell(), maybe_make_export_env(), pop_scope(), pop_var_context(), push_var_context(), and shell_reinitialize().
HASH_TABLE* shell_functions = (HASH_TABLE *) 0x0 |
Definition at line 111 of file variables.c.
Referenced by shell_reinitialize().
HASH_TABLE* invalid_env = (HASH_TABLE *) 0x0 |
Definition at line 113 of file variables.c.
Referenced by maybe_make_export_env().
int variable_context = 0 |
Definition at line 123 of file variables.c.
Referenced by all_local_variables(), assign_in_env(), bind_variable_value(), execute_command(), execute_command_internal(), execute_disk_command(), execute_for_command(), execute_function(), execute_if_command(), execute_simple_command(), executing_line_number(), find_variable_nameref(), get_bash_command(), get_funcname(), initialize_subshell(), kill_all_local_variables(), local_and_exported(), make_local_variable(), makunbound(), nameref_transform_name(), new_var_context(), parse_and_execute(), pop_context(), push_context(), reader_loop(), set_context(), set_dollar_vars_changed(), strip_trailing_ifs_whitespace(), and variable_in_context().
int localvar_inherit = 0 |
Definition at line 127 of file variables.c.
Referenced by make_local_variable(), and make_new_variable().
int localvar_unset = 0 |
Definition at line 132 of file variables.c.
Referenced by makunbound().
HASH_TABLE* temporary_env = (HASH_TABLE *) 0x0 |
Definition at line 136 of file variables.c.
Referenced by _run_trap_internal(), execute_builtin(), execute_function(), execute_simple_command(), maybe_make_export_env(), reader_loop(), run_pending_traps(), and run_sigchld_trap().
int tempenv_assign_error |
Definition at line 140 of file variables.c.
Referenced by execute_simple_command(), and expand_word_list_internal().
char* dollar_vars[10] |
Definition at line 144 of file variables.c.
Referenced by assign_bash_argv0(), bind_args(), expand_word_internal(), free_dollar_vars(), get_bash_argv0(), get_dollar_var_value(), get_name_for_error(), initialize_shell_variables(), list_rest_of_args(), number_of_args(), open_shell_script(), param_expand(), pos_params(), remember_args(), restore_dollar_vars(), save_dollar_vars(), set_bash_input(), and set_shell_name().
Definition at line 145 of file variables.c.
Referenced by get_dollar_var_value(), list_rest_of_args(), number_of_args(), push_dollar_vars(), and remember_args().
pid_t dollar_dollar_pid |
Definition at line 148 of file variables.c.
Referenced by execute_pipeline(), initialize_shell_variables(), param_expand(), parameter_brace_expand_length(), push_builtin(), sh_mktmpfd(), sh_mktmpname(), and termsig_handler().
int array_needs_making = 1 |
Definition at line 151 of file variables.c.
Referenced by assign_in_env(), bind_function(), bind_variable_internal(), bind_variable_value(), chkexport(), dispose_temporary_env(), dispose_variable(), initialize_shell_variables(), makunbound(), maybe_make_export_env(), sv_globignore(), and unbind_func().
int shell_level = 0 |
Definition at line 155 of file variables.c.
Referenced by adjust_shell_level(), get_tty_state(), run_startup_files(), and set_tty_state().
char** export_env = (char **) 0x0 |
Definition at line 160 of file variables.c.
Referenced by add_or_supercede_exported_var(), add_temp_array_to_env(), bperl_builtin(), execute_disk_command(), maybe_make_export_env(), printenv_builtin(), and update_export_env_inplace().
|
static |
Definition at line 161 of file variables.c.
Referenced by add_or_supercede_exported_var(), and maybe_make_export_env().
|
static |
Definition at line 162 of file variables.c.
Referenced by maybe_make_export_env().
SHELL_VAR nameref_invalid_value |
Definition at line 168 of file variables.c.
|
static |
Definition at line 169 of file variables.c.
|
static |
Definition at line 171 of file variables.c.
|
static |
Definition at line 1266 of file variables.c.
|
static |
Definition at line 1314 of file variables.c.
|
static |
Definition at line 1315 of file variables.c.
|
static |
Definition at line 1316 of file variables.c.
|
static |
Definition at line 1531 of file variables.c.
Referenced by assign_bash_argv0().
char** tempvar_list |
Definition at line 4418 of file variables.c.
int tvlist_ind |
Definition at line 4419 of file variables.c.
Referenced by dispose_temporary_env().
|
static |
Definition at line 5333 of file variables.c.
|
static |
Definition at line 5334 of file variables.c.
|
static |
Definition at line 5335 of file variables.c.
Referenced by dispose_saved_dollar_vars(), pop_dollar_vars(), and push_dollar_vars().
|
static |
Definition at line 5559 of file variables.c.