diff --git a/bash-5.1/builtins_rust/alias/src/lib.rs b/bash-5.1/builtins_rust/alias/src/lib.rs index 614dde50fa1cf86a8af6c14f117bc9de343ca503..43a25252ecde6a6efe4cde9e709b07dc2d7db246 100644 --- a/bash-5.1/builtins_rust/alias/src/lib.rs +++ b/bash-5.1/builtins_rust/alias/src/lib.rs @@ -168,7 +168,11 @@ pub unsafe extern "C" fn r_alias_builtin(mut list: *mut WordList) -> libc::c_int } list = (*list).next; } - return if any_failed != 0 {EXECUTION_FAILURE!()} else { EXECUTION_SUCCESS!()}; + return if any_failed != 0 { + EXECUTION_FAILURE + } else { + EXECUTION_SUCCESS + }; } #[no_mangle] pub unsafe extern "C" fn r_unalias_builtin(mut list: *mut WordList) -> libc::c_int { @@ -257,18 +261,26 @@ unsafe fn legal_alias_rust(name: *mut libc::c_char, value: *mut libc::c_char) -> let mut new_value_2: *mut libc::c_char; let mut _shell_bui: *mut libc::c_char; let mut t: *mut AliasT; - let dflags ; - dflags = if posixly_correct != 0 { 0 as libc::c_int } else { 0x1 as libc::c_int }; - - if libc::strstr(value,CString::new(";").unwrap().as_ptr() as *mut libc::c_char) != std::ptr::null_mut() { + let dflags; + dflags = if posixly_correct != 0 { + 0 as libc::c_int + } else { + 0x1 as libc::c_int + }; + + if libc::strstr( + value, + CString::new(";").unwrap().as_ptr() as *mut libc::c_char, + ) != std::ptr::null_mut() + { println!("; is not allow in alias"); - return 1; + return 0; } t = find_alias(name); if !t.is_null() { println!("{} is already in alias", CStr::from_ptr(name).to_string_lossy().into_owned()); print_alias(t, dflags); - return 1; + return 0; } name_w = find_user_command(name); new_value = sh_single_quote(value); diff --git a/bash-5.1/r_print_cmd/src/lib.rs b/bash-5.1/r_print_cmd/src/lib.rs index 4006efb7d5b1bed6965dcf9f5300e3c09e26dcab..1e15de605d96378c51658ae327fec755e00f14bc 100644 --- a/bash-5.1/r_print_cmd/src/lib.rs +++ b/bash-5.1/r_print_cmd/src/lib.rs @@ -1568,6 +1568,22 @@ pub unsafe extern "C" fn r_named_function_string(name:*mut c_char, command:*mut ); cmdcopy = copy_command(command); + func_redirects = std::ptr::null_mut(); + if (*cmdcopy).type_ == command_type_cm_group + { + func_redirects = (*cmdcopy).redirects; + (*cmdcopy).redirects = 0 as *mut redirect ; + } + + make_command_string_internal(if (*cmdcopy).type_ == command_type_cm_group { + (*(*cmdcopy).value.Group).command + } else { + cmdcopy + }, + ); + + PRINT_DEFERRED_HEREDOCS!(b"\0" as *const u8 as *const c_char); + }