From 7f5f2cad53c67b133e03df2b5dc522b40a8bd6d4 Mon Sep 17 00:00:00 2001 From: wangmengc Date: Tue, 31 Oct 2023 10:11:55 +0800 Subject: [PATCH] setup_async_signals function NOTFOUND_HOOK macro --- bash-5.1/r_execute_cmd/src/lib.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bash-5.1/r_execute_cmd/src/lib.rs b/bash-5.1/r_execute_cmd/src/lib.rs index 8279fe5..6c4955a 100644 --- a/bash-5.1/r_execute_cmd/src/lib.rs +++ b/bash-5.1/r_execute_cmd/src/lib.rs @@ -5701,8 +5701,27 @@ unsafe extern "C" fn execute_builtin_or_function( return result; } +#[no_mangle] +pub unsafe extern "C" fn setup_async_signals() { + if job_control == 0 { + get_original_signal(SIGINT as libc::c_int); + set_signal_handler( + SIGINT as libc::c_int, + SIG_IGN!()); + get_original_signal(SIGQUIT as libc::c_int); + set_signal_handler( + SIGQUIT as libc::c_int, + SIG_IGN!()); + } +} +#[macro_export] +macro_rules! NOTFOUND_HOOK { + () => { + b"command_not_found_handle\0" as *const u8 as *const libc::c_char + }; +} -- Gitee