diff --git a/bash-5.1/builtins_rust/exec_cmd/src/lib.rs b/bash-5.1/builtins_rust/exec_cmd/src/lib.rs index 0a31ecedb72eb7bb98da2f14c1aff868e7999efa..6825fbe3570c1d4dbc7ecedc714fc290a8bee11f 100644 --- a/bash-5.1/builtins_rust/exec_cmd/src/lib.rs +++ b/bash-5.1/builtins_rust/exec_cmd/src/lib.rs @@ -864,7 +864,8 @@ unsafe fn get_cmd_type (command : *mut i8) -> CMDType{ types = CMDType::SuspendCmd; } - else if libc::strcmp(command,b"test\0" as *const u8 as *const i8 as *mut i8) == 0{ + else if libc::strcmp(command,b"test\0" as *const u8 as *const i8 as *mut i8) == 0 + || libc::strcmp(command,b"[\0" as *const u8 as *const i8 as *mut i8)== 0 { types = CMDType::TestCmd; } diff --git a/bash-5.1/builtins_rust/shift/src/lib.rs b/bash-5.1/builtins_rust/shift/src/lib.rs index 746196e15cb6feae566ebada7d11f4d4c4e0d021..ae2d00a0963ce1343b590cad8daf96972709ab9f 100644 --- a/bash-5.1/builtins_rust/shift/src/lib.rs +++ b/bash-5.1/builtins_rust/shift/src/lib.rs @@ -33,9 +33,9 @@ unsafe { if times > nargs { if print_shift_error != 0 { let s = if list.is_null() {PT_NULL as *mut c_char} else {(*(*list).word).word}; - r_sh_erange(s,"shift count\0".as_ptr() as *mut c_char); - return EXECUTION_FAILURE; + r_sh_erange(s,"shift count\0".as_ptr() as *mut c_char); } + return EXECUTION_FAILURE; } else if times == nargs { clear_dollar_vars(); } else { diff --git a/bash-5.1/builtins_rust/shopt/src/lib.rs b/bash-5.1/builtins_rust/shopt/src/lib.rs index c557ab770e664b3cc19575d38c2ecfc052ed6002..717189df680d48c9c6af52d7e048649e40f8bde8 100644 --- a/bash-5.1/builtins_rust/shopt/src/lib.rs +++ b/bash-5.1/builtins_rust/shopt/src/lib.rs @@ -926,7 +926,7 @@ pub unsafe extern "C" fn r_shopt_builtin(mut list: *mut WordList) -> i32 { reset_internal_getopt(); let psuoq = CString::new("psuoq").expect("CString::new failed"); loop { - opt = internal_getopt( list, psuoq.as_ptr() as *mut c_char); + opt = internal_getopt( list, psuoq.as_ptr() as *mut i8); if !(opt != -(1 as i32)) { break; } diff --git a/bash-5.1/builtins_rust/source/src/lib.rs b/bash-5.1/builtins_rust/source/src/lib.rs index a33457a46170f4c26f503b8e1cc0c348c6fab99e..190eb0a02136a9e6a7959a6505cf81e01d71d1ae 100644 --- a/bash-5.1/builtins_rust/source/src/lib.rs +++ b/bash-5.1/builtins_rust/source/src/lib.rs @@ -294,6 +294,7 @@ unsafe fn DEBUG_TRAP()->i32 #[no_mangle] pub extern "C" fn r_source_builtin (list:* mut WordList)->i32 { + let mut result:i32; let mut filename:*mut c_char; let mut debug_trap:* mut c_char; @@ -306,7 +307,7 @@ pub extern "C" fn r_source_builtin (list:* mut WordList)->i32 let mut llist:* mut WordList = loptend.clone(); if list == std::ptr::null_mut() { - builtin_error (CString::new("filename argument required").unwrap().as_ptr()); + builtin_error (b"filename argument required\0" as *const u8 as *const i8 as *mut i8 ); builtin_usage (); return EX_USAGE; } @@ -344,7 +345,7 @@ pub extern "C" fn r_source_builtin (list:* mut WordList)->i32 } } - begin_unwind_frame (CString::new("source").unwrap().as_ptr() as * mut c_char); + begin_unwind_frame (b"source\0" as *const u8 as *const i8 as *mut i8); let xf:Functions=Functions{f_xfree :xfree}; add_unwind_protect (xf, filename); @@ -380,7 +381,7 @@ pub extern "C" fn r_source_builtin (list:* mut WordList)->i32 result = source_file (filename, (list !=std::ptr::null_mut() && (*list).next !=std::ptr::null_mut()) as i32); - run_unwind_frame (CString::new("source").unwrap().as_ptr() as * mut c_char); + run_unwind_frame (b"source\0" as *const u8 as *const i8 as *mut i8); return result; } diff --git a/bash-5.1/builtins_rust/suspend/src/lib.rs b/bash-5.1/builtins_rust/suspend/src/lib.rs index 3798740cfc9feacefa875018a9628bf627ca0e94..bf5b428f838439d6c05488ec38ffaf09dd80da31 100644 --- a/bash-5.1/builtins_rust/suspend/src/lib.rs +++ b/bash-5.1/builtins_rust/suspend/src/lib.rs @@ -14,7 +14,7 @@ pub extern "C" fn r_suspend_builtin(mut list: *mut WordList) -> i32 { unsafe { reset_internal_getopt(); - let opt_str = "f:\0".as_ptr() as *mut c_char; + let opt_str = "f\0".as_ptr() as *mut c_char; opt = internal_getopt (list, opt_str); while opt != -1 { let opt_char:char=char::from(opt as u8); @@ -25,15 +25,14 @@ unsafe { return EX_USAGE; } } + opt = internal_getopt (list, opt_str); } list = loptend; - if job_control == 0 { sh_nojobs("cannot suspend\0".as_ptr() as *mut c_char); return EXECUTION_FAILURE; } - if force == 0 { r_no_args(list); if login_shell != 0 { @@ -43,7 +42,6 @@ unsafe { } old_cont = set_signal_handler(libc::SIGCONT, std::mem::transmute(suspend_continue as usize)); - killpg(shell_pgrp, libc::SIGSTOP); } return EXECUTION_SUCCESS; diff --git a/record.txt b/record.txt index 6f4a83de9c9ef73de9222971367e1d8a62bc1688..3d7f153438ef12b8b0aa31a56b850d00f19ba4ab 100644 --- a/record.txt +++ b/record.txt @@ -37,3 +37,4 @@ 59 60 61 +62