From 7ac42e83ae9677a42e549579047d9593a348e069 Mon Sep 17 00:00:00 2001 From: wangmengc Date: Tue, 31 Oct 2023 10:26:50 +0800 Subject: [PATCH] vc_isbltnenv macro, initialize_subshell function --- bash-5.1/r_execute_cmd/src/lib.rs | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/bash-5.1/r_execute_cmd/src/lib.rs b/bash-5.1/r_execute_cmd/src/lib.rs index 51847e8..fd0f82c 100644 --- a/bash-5.1/r_execute_cmd/src/lib.rs +++ b/bash-5.1/r_execute_cmd/src/lib.rs @@ -5918,8 +5918,43 @@ unsafe extern "C" fn getinterp( return execname; } +#[macro_export] +macro_rules! vc_isbltnenv { + ($vc:expr) => { + (*$vc).flags & VC_BLTNENV as libc::c_int != 0 + }; +} + +unsafe extern "C" fn initialize_subshell() { + delete_all_aliases(); + history_lines_this_session = 0 ; + without_job_control(); + + set_sigchld_handler(); + init_job_stats(); + reset_shell_flags(); + reset_shell_options(); + reset_shopt_options(); + + if vc_isbltnenv!(shell_variables) { + shell_variables = (*shell_variables).down; + } + + clear_unwind_protect_list(0 ); + parse_and_execute_level = 0 ; + sourcenest = 0 ; + evalnest = sourcenest; + funcnest = evalnest; + return_catch_flag = funcnest; + variable_context = return_catch_flag; + + executing_list = 0 ; + if interactive_shell == 0 { + unset_bash_input(0 ); + } +} -- Gitee