From cd5284e65f9c90b5908a907cbd5f736ab7b02dbf Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Tue, 4 Dec 2018 03:34:54 +0000 Subject: [PATCH] removed moo_ignore_termreq() --- moo/lib/main.c | 11 +++++++++++ moo/lib/moo-std.h | 4 ---- moo/lib/std.c | 22 ++-------------------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/moo/lib/main.c b/moo/lib/main.c index fb84df8..74f8bfd 100644 --- a/moo/lib/main.c +++ b/moo/lib/main.c @@ -33,6 +33,10 @@ #include #include +#if (defined(__unix) || defined(__linux) || defined(__ultrix) || defined(_AIX) || defined(__hpux) || defined(__sgi)) && defined(HAVE_SIGNAL_H) +# include +#endif + static void print_syntax_error (moo_t* moo, const char* main_src_file) { moo_synerr_t synerr; @@ -274,6 +278,13 @@ int main (int argc, char* argv[]) MOO_DEBUG0 (moo, "COMPILE OK. STARTING EXECUTION...\n"); xret = 0; +#if defined(SIGINT) && defined(HAVE_SIGNAL) + /* i'd like the program to ignore the interrupt signal + * before moo_catch_termreq() and after moo_uncatch_termreq() */ + signal (SIGINT, SIG_IGN); + signal (SIGTERM, SIG_IGN); +#endif + moo_catch_termreq (); moo_start_ticker (); diff --git a/moo/lib/moo-std.h b/moo/lib/moo-std.h index c90e47c..f4a8e88 100644 --- a/moo/lib/moo-std.h +++ b/moo/lib/moo-std.h @@ -93,10 +93,6 @@ MOO_EXPORT void moo_uncatch_termreq ( void ); -MOO_EXPORT void moo_ignore_termreq ( - void -); - /* ----------------------------------------------------------------------- */ MOO_EXPORT moo_t* moo_openstd ( moo_oow_t xtnsize, diff --git a/moo/lib/std.c b/moo/lib/std.c index 9caee18..2b39c1f 100644 --- a/moo/lib/std.c +++ b/moo/lib/std.c @@ -3698,11 +3698,6 @@ void moo_uncatch_termreq (void) SetConsoleCtrlHandler (handle_term, FALSE); } -void moo_ignore_termreq (void) -{ - /* TODO: ... */ -} - #elif defined(__OS2__) static EXCEPTIONREGISTRATIONRECORD os2_excrr = { 0 }; @@ -3738,11 +3733,6 @@ void moo_uncatch_termreq (void) DosUnsetExceptionHandler (&os2_excrr); } -void moo_ignore_termreq (void) -{ - /* TODO: ... */ -} - #elif defined(__DOS__) #if defined(_INTELC32_) @@ -3779,26 +3769,18 @@ void moo_uncatch_termreq (void) _dos_setvect (0x23, dos_int23_handler); } -void moo_ignore_termreq (void) -{ - /* TODO: */ -} - #else void moo_catch_termreq (void) { + set_signal_handler(SIGTERM, abort_all_moos, 0); set_signal_handler(SIGINT, abort_all_moos, 0); } void moo_uncatch_termreq (void) { unset_signal_handler(SIGTERM); -} - -void moo_ignore_termreq (void) -{ - set_signal_handler(SIGINT, SIG_IGN, 0); + unset_signal_handler(SIGINT); } #endif