mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
moved /SET ignore_signals to core.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1534 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
4ee6270965
commit
6f5c1117de
@ -19,8 +19,10 @@
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include <signal.h>
|
||||
|
||||
#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();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user