From 67b43e6e5c649dedbf07ab73dc81c43f2d7076a1 Mon Sep 17 00:00:00 2001 From: wangmengc Date: Wed, 5 Jun 2024 09:43:37 +0800 Subject: [PATCH] add CHECK_TERMSIG QUIT macro --- utshell-0.5/r_input/src/lib.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/utshell-0.5/r_input/src/lib.rs b/utshell-0.5/r_input/src/lib.rs index 3b044649..317b024b 100644 --- a/utshell-0.5/r_input/src/lib.rs +++ b/utshell-0.5/r_input/src/lib.rs @@ -142,4 +142,24 @@ pub struct BASH_INPUT { pub location: INPUT_STREAM, pub getter: Option, pub ungetter: Option, +} + +#[macro_export] +macro_rules! CHECK_TERMSIG { + () => { + if terminating_signal != 0 { + termsig_handler(terminating_signal); + } + }; +} +#[macro_export] +macro_rules! QUIT { + () => { + if terminating_signal != 0 { + termsig_handler(terminating_signal); + } + if interrupt_state != 0 { + throw_to_top_level(); + } + }; } \ No newline at end of file -- Gitee