diff --git a/bash-5.1/builtins_rust/common/src/lib.rs b/bash-5.1/builtins_rust/common/src/lib.rs index 34f16a47c134f5b6771bccaee4715784be2cdd03..696f3bcbe3e5a857c4c702a9ba73adabddae76b6 100644 --- a/bash-5.1/builtins_rust/common/src/lib.rs +++ b/bash-5.1/builtins_rust/common/src/lib.rs @@ -350,7 +350,7 @@ macro_rules! DEBUG_TRAP { #[macro_export] macro_rules! NSIG { () => { - 64 + 65 }; } 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 ad9fc7066ba85fda35bb67c6b9606c177c4d8981..23bb0478f51e813e4c4fec98b417d6c088ddd2e0 100644 --- a/bash-5.1/builtins_rust/exec_cmd/src/lib.rs +++ b/bash-5.1/builtins_rust/exec_cmd/src/lib.rs @@ -23,6 +23,7 @@ use rhash::r_hash_builtin; use rhelp::r_help_builtin; use rhistory::r_history_builtin; use rjobs::r_jobs_builtin; +use rjobs::r_disown_builtin; use rkill::r_kill_builtin; use rmapfile::r_mapfile_builtin; use rprintf::r_printf_builtin; @@ -105,7 +106,8 @@ enum CMDType { TypeCmd, UlimitCmd, UmaskCmd, - WaitCmd + WaitCmd, + DisownCmd } struct AliasComand ; @@ -496,6 +498,15 @@ impl CommandExec for UnSetComand{ } } + struct DisownCommand ; + impl CommandExec for DisownCommand{ + fn excute(&self,list : *mut WordList)-> i32{ + unsafe { + r_disown_builtin(list) + } + } + } + // 定义接口 pub trait CommandExec { fn excute(&self,list : *mut WordList) -> i32; @@ -690,6 +701,9 @@ impl Factory for SimpleFactory { ), CMDType::WaitCmd => Box::new( WaitComand{} + ), + CMDType::DisownCmd => Box::new( + DisownCommand{} ) } } @@ -892,6 +906,9 @@ unsafe fn get_cmd_type (command : *mut libc::c_char) -> CMDType{ else if libc::strcmp(command , b"wait\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 { types = CMDType::WaitCmd; } + else if libc::strcmp(command , b"disown\0" as *const u8 as *const libc::c_char as *mut libc::c_char) == 0 { + types = CMDType::DisownCmd; + } types } diff --git a/bash-5.1/builtins_rust/jobs/src/lib.rs b/bash-5.1/builtins_rust/jobs/src/lib.rs index 18e88ec748436d30ee9a3e84be4c6f8122f2256e..6b9fa888cfed3ca6a2f719357dcd43e56bb70c55 100644 --- a/bash-5.1/builtins_rust/jobs/src/lib.rs +++ b/bash-5.1/builtins_rust/jobs/src/lib.rs @@ -337,7 +337,7 @@ macro_rules! get_job_by_jid { #[macro_export] macro_rules! INVALID_JOB { ($j:expr) => { - $j <0 || $j >= js.j_jobslots || get_job_by_jid !($j) == std::ptr::null_mut() + $j <0 || $j >= js.j_jobslots || get_job_by_jid!($j) == std::ptr::null_mut() } } @@ -390,7 +390,7 @@ extern "C" { } libc::free((*(*l).word).word as * mut libc::c_void); - (*(*(*l).word).word) = (*get_job_by_jid! (job)).pgrp as libc::c_char; + (*(*(*l).word).word) = (*get_job_by_jid!(job)).pgrp as libc::c_char; } l=(*l).next; } @@ -484,7 +484,7 @@ pub extern "C" fn r_jobs_builtin(mut list:*mut WordList)->i32 { BLOCK_CHILD !(Some(&mut set), Some(&mut oset)); job = get_job_spec (list); - if (job == NO_JOB!()) || jobs == std::ptr::null_mut() || get_job_by_jid !(job) == std::ptr::null_mut() { + if (job == NO_JOB!()) || jobs == std::ptr::null_mut() || get_job_by_jid!(job) == std::ptr::null_mut() { sh_badjob ((*((*list).word)).word); any_failed+=1; } else if job != DUP_JOB!() { @@ -547,14 +547,13 @@ pub extern "C" fn r_disown_builtin (list:* mut WordList)->libc::c_int { } return EXECUTION_SUCCESS!(); } - BLOCK_CHILD !(Some(&mut set), Some(&mut oset)); if (loptend !=std::ptr::null_mut() && legal_number ((*(*loptend).word).word, &mut pid_value) !=0 && pid_value == pid_value) { job=get_job_by_pid ( pid_value as i32, 0, 0 as *mut*mut PROCESS); }else { - get_job_spec (loptend); + job = get_job_spec (loptend); } - if job == NO_JOB!() || jobs !=std::ptr::null_mut() || INVALID_JOB!(job) { + if (job == NO_JOB!()) ||( jobs ==std::ptr::null_mut()) || (INVALID_JOB!(job)) { if loptend !=std::ptr::null_mut() { sh_badjob ((*(*loptend).word).word); } else { diff --git a/bash-5.1/execute_cmd.c b/bash-5.1/execute_cmd.c index d1a9f1b5d217d7be3e2faf44e54866bafba1b223..b2933f7f0cf5ed34f86f599f0c9893b7b1630a94 100644 --- a/bash-5.1/execute_cmd.c +++ b/bash-5.1/execute_cmd.c @@ -4839,9 +4839,8 @@ execute_builtin (builtin, words, flags, subshell) executing_builtin++; executing_command_builtin |= builtin == command_builtin; - //result = ((*builtin) (words->next)); + // result = ((*builtin) (words->next)); result = r_exec_cmd(words->word->word, words->next); - //r_execute_cmd2(words->next); /* This shouldn't happen, but in case `return' comes back instead of longjmp'ing, we need to unwind. */ @@ -5814,7 +5813,6 @@ shell_execve (command, args, env) char *command; char **args, **env; { - //printf("wwwwwwwwwwwwwwwwwwwwwwwwww===========\n"); int larray, i, fd; char sample[HASH_BANG_BUFSIZ]; int sample_len; diff --git a/record.txt b/record.txt index 6836ce751ccadca70261c8dd20204b5932d15bef..32559b8176f8253091243c24b124a6a495d3e2c8 100644 --- a/record.txt +++ b/record.txt @@ -49,3 +49,4 @@ 71 72 73 +74