From 6f5c1117debce23e12fdba370f0356bebf61d355 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 1 Jun 2001 20:21:07 +0000 Subject: [PATCH] moved /SET ignore_signals to core. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1534 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/core/core.c | 38 ++++++++++++++++++++++++++++++++++++++ src/fe-text/screen.c | 32 -------------------------------- 2 files changed, 38 insertions(+), 32 deletions(-) diff --git a/src/core/core.c b/src/core/core.c index fd7459db..62bf7904 100644 --- a/src/core/core.c +++ b/src/core/core.c @@ -19,8 +19,10 @@ */ #include "module.h" +#include #include "pidwait.h" +#include "misc.h" #include "net-disconnect.h" #include "net-sendbuffer.h" @@ -47,6 +49,35 @@ void chat_commands_deinit(void); int irssi_gui; +static void read_signals(void) +{ +#ifndef WIN32 + int signals[] = { + SIGHUP, SIGINT, SIGQUIT, SIGTERM, + SIGALRM, SIGUSR1, SIGUSR2 + }; + char *signames[] = { + "hup", "int", "quit", "term", + "alrm", "usr1", "usr2" + }; + + const char *ignores; + struct sigaction act; + int n; + + ignores = settings_get_str("ignore_signals"); + + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + + for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) { + act.sa_handler = find_substr(ignores, signames[n]) ? + SIG_IGN : SIG_DFL; + sigaction(signals[n], &act, NULL); + } +#endif +} + void core_init(void) { modules_init(); @@ -75,11 +106,18 @@ void core_init(void) nicklist_init(); chat_commands_init(); + + settings_add_str("misc", "ignore_signals", ""); + signal_add("setup changed", (SIGNAL_FUNC) read_signals); + read_signals(); + settings_check(); } void core_deinit(void) { + signal_remove("setup changed", (SIGNAL_FUNC) read_signals); + chat_commands_deinit(); nicklist_deinit(); diff --git a/src/fe-text/screen.c b/src/fe-text/screen.c index 5378b5c9..ea4a9add 100644 --- a/src/fe-text/screen.c +++ b/src/fe-text/screen.c @@ -76,41 +76,11 @@ static void sig_winch(int p) } #endif -static void read_signals(void) -{ -#ifndef WIN32 - int signals[] = { - SIGHUP, SIGINT, SIGQUIT, SIGTERM, - SIGALRM, SIGUSR1, SIGUSR2 - }; - char *signames[] = { - "hup", "int", "quit", "term", - "alrm", "usr1", "usr2" - }; - - const char *ignores; - struct sigaction act; - int n; - - ignores = settings_get_str("ignore_signals"); - - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - - for (n = 0; n < sizeof(signals)/sizeof(signals[0]); n++) { - act.sa_handler = find_substr(ignores, signames[n]) ? - SIG_IGN : SIG_DFL; - sigaction(signals[n], &act, NULL); - } -#endif -} - static void read_settings(void) { int old_colors = use_colors; use_colors = settings_get_bool("colors"); - read_signals(); if (use_colors && !has_colors()) use_colors = FALSE; @@ -172,7 +142,6 @@ static int init_curses(void) static int init_screen_int(void) { use_colors = settings_get_bool("colors"); - read_signals(); scrx = scry = 0; freeze_refresh = 0; @@ -189,7 +158,6 @@ static void deinit_screen_int(void) int init_screen(void) { settings_add_bool("lookandfeel", "colors", TRUE); - settings_add_str("misc", "ignore_signals", ""); signal_add("setup changed", (SIGNAL_FUNC) read_settings); return init_screen_int();