From 00c18b9e6269a26d0763ce2a8106c55ea0b73f54 Mon Sep 17 00:00:00 2001 From: wangmengc Date: Mon, 14 Aug 2023 10:19:08 +0800 Subject: [PATCH] fix 160413 umask fmt error --- bash-5.1/builtins_rust/common/src/lib.rs | 5 +++-- bash-5.1/builtins_rust/jobs/src/lib.rs | 4 ++++ bash-5.1/builtins_rust/umask/src/lib.rs | 12 ++++++++++-- record.txt | 1 + 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/bash-5.1/builtins_rust/common/src/lib.rs b/bash-5.1/builtins_rust/common/src/lib.rs index 696f3bc..332e7e2 100644 --- a/bash-5.1/builtins_rust/common/src/lib.rs +++ b/bash-5.1/builtins_rust/common/src/lib.rs @@ -1757,7 +1757,7 @@ pub extern "C" fn r_builtin_unbind_variable(vname:*const c_char)->i32{ pub extern "C" fn get_local_str()-> Vec{ let lang : String; - match var("LANGUAGE") { + match var("LANG") { Ok(v) => lang = v , Err(e) => { @@ -1767,7 +1767,8 @@ pub extern "C" fn get_local_str()-> Vec{ } // println!("now language is {:?}",lang); //parse() 用于类型转换 - let langid : LanguageIdentifier = lang.parse().expect("wrong language"); + let v: Vec<_> = lang.split('.').collect(); + let langid : LanguageIdentifier = v[0].parse().expect("wrong language"); let locales = vec![langid.into()]; return locales; } diff --git a/bash-5.1/builtins_rust/jobs/src/lib.rs b/bash-5.1/builtins_rust/jobs/src/lib.rs index 6b9fa88..d16b894 100644 --- a/bash-5.1/builtins_rust/jobs/src/lib.rs +++ b/bash-5.1/builtins_rust/jobs/src/lib.rs @@ -330,7 +330,11 @@ macro_rules! CMD_INHIBIT_EXPANSION {/* Do not expand the command words. */ #[macro_export] macro_rules! get_job_by_jid { ($ind:expr) => { + //(*((jobs as usize + ($ind*8) as usize ) as *mut*mut JOB) as *mut JOB) + //println!("====jobs.offset={:?}", (*jobs.offset($ind as isize))); + //(*((*jobs.offset($ind)) as *mut *mut JOB) as *mut JOB) (*((jobs as usize + ($ind*8) as usize ) as *mut*mut JOB) as *mut JOB) + } } diff --git a/bash-5.1/builtins_rust/umask/src/lib.rs b/bash-5.1/builtins_rust/umask/src/lib.rs index 399070d..5ad7504 100644 --- a/bash-5.1/builtins_rust/umask/src/lib.rs +++ b/bash-5.1/builtins_rust/umask/src/lib.rs @@ -247,7 +247,15 @@ pub extern "C" fn r_umask_builtin(mut list:*mut WordList) ->i32{ else{ /* Display the UMASK for this user. */ umask_arg = umask(0o22); umask(umask_arg); - + if pflag != 0{ + if print_symbolically != 0{ + println!("umask -S"); + } + else{ + print!("umask ") + } + } +/* if pflag != 0{ if print_symbolically != 0{ println!("umask \" -S\" "); @@ -256,7 +264,7 @@ pub extern "C" fn r_umask_builtin(mut list:*mut WordList) ->i32{ println!("umask \"\" ") } } - +*/ if print_symbolically != 0{ r_print_symbolic_umask(umask_arg); } diff --git a/record.txt b/record.txt index 319eaaa..fefbf28 100644 --- a/record.txt +++ b/record.txt @@ -75,3 +75,4 @@ 74 75 76 +77 -- Gitee