From 2897a69f6aa48902dcf2897eb619179e1be30fff Mon Sep 17 00:00:00 2001 From: wangmengc Date: Mon, 16 Oct 2023 18:08:15 +0800 Subject: [PATCH] add get_job_by_jid function, INVALID_JOB function and values for execute connection function --- bash-5.1/r_execute_cmd/src/lib.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/bash-5.1/r_execute_cmd/src/lib.rs b/bash-5.1/r_execute_cmd/src/lib.rs index 03d9a75f..f0f4f49a 100644 --- a/bash-5.1/r_execute_cmd/src/lib.rs +++ b/bash-5.1/r_execute_cmd/src/lib.rs @@ -2292,6 +2292,18 @@ unsafe extern "C" fn restore_stdin(mut s: libc::c_int) { unsafe extern "C" fn lastpipe_cleanup(mut s: libc::c_int) { set_jobs_list_frozen(s); } +#[macro_export] +macro_rules! get_job_by_jid { + ($ind:expr) => { + (*jobs).offset($ind as isize) + }; +} +#[macro_export] +macro_rules! INVALID_JOB { + ($j:expr) => { + ($j < 0 || $j >= js.j_jobslots || get_job_by_jid!($j) == 0 as *mut job) + }; +} unsafe extern "C" fn execute_pipeline( mut command: *mut COMMAND, @@ -2529,5 +2541,8 @@ unsafe extern "C" fn execute_pipeline( return exec_result; } - - +const FLAG_AND:i32 = '&' as i32; +const FLAG_SEMICOLON:i32 = ';' as i32; +const FLAG_OR:i32 = '|' as i32; +const FLAG_OR_OR:i32 = OR_OR as i32; +const FLAG_AND_AND:i32 = AND_AND as i32; -- Gitee