diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2018-03-16 20:10:57 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2018-03-16 20:10:57 +0100 |
commit | 71999e17c6a1e7e4b4368b52df07bad8a6d81b02 (patch) | |
tree | add55cd2323ad5cd572874b51a1c3dddeab0ba23 /src/gui | |
parent | 84f4e31425f2f10edd5f97f8887a2b75c224b405 (diff) | |
download | weechat-71999e17c6a1e7e4b4368b52df07bad8a6d81b02.zip |
core: quit WeeChat on ctrl-C (signal SIGINT) in headless mode
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-main.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index faf358bdf..7355f7dee 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -143,6 +143,16 @@ gui_main_get_password (const char **prompt, char *password, int size) } /* + * Callback for system signal SIGINT: quits WeeChat. + */ + +void +gui_main_signal_sigint () +{ + weechat_quit = 1; +} + +/* * Initializes GUI. */ @@ -154,6 +164,11 @@ gui_main_init () struct t_gui_bar_window *ptr_bar_win; char title[256]; +#ifdef WEECHAT_HEADLESS + /* allow Ctrl-C to quit WeeChat in headless mode */ + util_catch_signal (SIGINT, &gui_main_signal_sigint); +#endif /* WEECHAT_HEADLESS */ + initscr (); if (CONFIG_BOOLEAN(config_look_eat_newline_glitch)) |