diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-07-14 07:04:45 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-07-14 07:04:45 +0000 |
commit | a9912cd2664287998bc80aef6c092d6ed49d40eb (patch) | |
tree | c33ff07bfaf7f12ed95c73cd7592e640c1ff79f9 | |
parent | 1d07964d1735cbe0b997444c05670f3858bafd94 (diff) | |
download | weechat-a9912cd2664287998bc80aef6c092d6ed49d40eb.zip |
- fixed SIGSEGV handler (now write a core file by aborting program)
- fixed statusbar & infobar background refresh problem with some systems
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/common/weechat.c | 54 | ||||
-rw-r--r-- | src/common/weechat.h | 2 | ||||
-rw-r--r-- | src/gui/curses/gui-display.c | 16 | ||||
-rw-r--r-- | src/gui/gui-common.c | 24 | ||||
-rw-r--r-- | weechat/ChangeLog | 4 | ||||
-rw-r--r-- | weechat/src/common/weechat.c | 54 | ||||
-rw-r--r-- | weechat/src/common/weechat.h | 2 | ||||
-rw-r--r-- | weechat/src/gui/curses/gui-display.c | 16 | ||||
-rw-r--r-- | weechat/src/gui/gui-common.c | 24 |
10 files changed, 92 insertions, 108 deletions
@@ -1,10 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-07-13 +ChangeLog - 2005-07-14 Version 0.1.4 (under dev!): + * fixed SIGSEGV handler (now write a core file by aborting program) + * fixed statusbar & infobar background refresh problem with some systems * added color for private in hotlist (different than color for highlight) * added DCC resume and timeout * added function for Perl/Python to get DCC list diff --git a/src/common/weechat.c b/src/common/weechat.c index c3f9a8352..625ae7eef 100644 --- a/src/common/weechat.c +++ b/src/common/weechat.c @@ -373,50 +373,50 @@ wee_parse_args (int argc, char *argv[]) || (strcmp (argv[i], "--config") == 0)) { wee_display_config_options (); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-f") == 0) || (strcmp (argv[i], "--key-functions") == 0)) { wee_display_key_functions (); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-h") == 0) || (strcmp (argv[i], "--help") == 0)) { printf ("\n" WEE_USAGE1, argv[0], argv[0]); printf ("%s", WEE_USAGE2); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-i") == 0) || (strcmp (argv[i], "--irc-commands") == 0)) { wee_display_commands (0, 1); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-k") == 0) || (strcmp (argv[i], "--keys") == 0)) { wee_display_keys (); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-l") == 0) || (strcmp (argv[i], "--license") == 0)) { printf ("\n%s%s", WEE_LICENSE); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-v") == 0) || (strcmp (argv[i], "--version") == 0)) { printf (PACKAGE_VERSION "\n"); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-w") == 0) || (strcmp (argv[i], "--weechat-commands") == 0)) { wee_display_commands (1, 0); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strncasecmp (argv[i], "irc", 3) == 0)) { @@ -492,7 +492,7 @@ wee_create_home_dirs () { fprintf (stderr, _("%s unable to get HOME directory\n"), WEECHAT_ERROR); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 0); } dir_length = strlen (ptr_home) + 10; weechat_home = @@ -501,7 +501,7 @@ wee_create_home_dirs () { fprintf (stderr, _("%s not enough memory for home directory\n"), WEECHAT_ERROR); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 0); } snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home, DIR_SEPARATOR); @@ -511,7 +511,7 @@ wee_create_home_dirs () { fprintf (stderr, _("%s unable to create ~/.weechat directory\n"), WEECHAT_ERROR); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 0); } dir_length = strlen (weechat_home) + 64; @@ -581,11 +581,11 @@ wee_init_vars () msgq_last_msg = NULL; /* init gnutls */ - #ifdef HAVE_GNUTLS +#ifdef HAVE_GNUTLS gnutls_global_init (); gnutls_certificate_allocate_credentials (&gnutls_xcred); gnutls_certificate_set_x509_trust_file (gnutls_xcred, "ca.pem", GNUTLS_X509_FMT_PEM); - #endif +#endif } /* @@ -669,7 +669,7 @@ wee_gui_shutdown () */ void -wee_shutdown (int return_code) +wee_shutdown (int return_code, int crash) { fifo_remove (); if (weechat_home) @@ -680,12 +680,15 @@ wee_shutdown (int return_code) free (local_charset); alias_free_all (); - #ifdef HAVE_GNUTLS +#ifdef HAVE_GNUTLS gnutls_certificate_free_credentials (gnutls_xcred); gnutls_global_deinit(); - #endif +#endif - exit (return_code); + if (crash) + abort(); + else + exit (return_code); } /* @@ -776,17 +779,6 @@ wee_dump (int crash) } /* - * my_sigint: SIGINT handler, do nothing (just ignore this signal) - * Prevents user for exiting with Ctrl-C - */ - -void -my_sigint () -{ - /* do nothing */ -} - -/* * my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit */ @@ -801,7 +793,7 @@ my_sigsegv () fprintf (stderr, "*** Please send this file to WeeChat developers.\n"); fprintf (stderr, "*** (be careful, private info may be in this file since\n"); fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n"); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 1); } /* @@ -821,7 +813,7 @@ main (int argc, char *argv[]) local_charset = strdup (nl_langinfo (CODESET)); #endif - signal (SIGINT, my_sigint); /* ignore SIGINT signal */ + signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */ signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */ gui_pre_init (&argc, &argv); /* pre-initiliaze interface */ wee_init_vars (); /* initialize some variables */ @@ -860,7 +852,7 @@ main (int argc, char *argv[]) (void) config_write (NULL); /* save config file */ command_index_free (); /* free commands index */ wee_gui_shutdown (); /* shut down WeeChat GUI */ - wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */ + wee_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */ return EXIT_SUCCESS; /* make gcc happy (never executed) */ } diff --git a/src/common/weechat.h b/src/common/weechat.h index 569ba7728..9304671a8 100644 --- a/src/common/weechat.h +++ b/src/common/weechat.h @@ -122,6 +122,6 @@ extern void wee_log_printf (char *, ...); extern void wee_dump (int); extern char *weechat_convert_encoding (char *, char *, char *); extern long get_timeval_diff (struct timeval *, struct timeval *); -extern void wee_shutdown (int); +extern void wee_shutdown (int, int); #endif /* weechat.h */ diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c index 9d8b54bb9..7a215a478 100644 --- a/src/gui/curses/gui-display.c +++ b/src/gui/curses/gui-display.c @@ -1082,11 +1082,14 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { + if (has_colors ()) + wbkgdset(ptr_win->win_status, ' ' | COLOR_PAIR (COLOR_WIN_STATUS)); + if (erase) gui_curses_window_clear (ptr_win->win_status); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); - wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); + /* wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */ wmove (ptr_win->win_status, 0, 0); /* display number of buffers */ @@ -1407,15 +1410,14 @@ gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase) for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { + if (has_colors ()) + wbkgdset(ptr_win->win_infobar, ' ' | COLOR_PAIR (COLOR_WIN_INFOBAR)); + if (erase) gui_curses_window_clear (ptr_win->win_infobar); - if (has_colors ()) - { - gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR); - wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); - wnoutrefresh (ptr_win->win_infobar); - } + gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR); + /* wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */ wmove (ptr_win->win_infobar, 0, 0); time_seconds = time (NULL); diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c index 7eeb4bfed..2cb5a6fb2 100644 --- a/src/gui/gui-common.c +++ b/src/gui/gui-common.c @@ -1009,20 +1009,16 @@ gui_input_delete_begin_of_line () void gui_input_delete_end_of_line () { - if (gui_current_window->buffer->input_buffer_pos > 0) - { - gui_input_clipboard_copy(gui_current_window->buffer->input_buffer + - gui_current_window->buffer->input_buffer_pos, - gui_current_window->buffer->input_buffer_size - - gui_current_window->buffer->input_buffer_pos); - } - - gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] = ' '; - gui_current_window->buffer->input_buffer_size = gui_current_window->buffer->input_buffer_pos ; - gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; - gui_draw_buffer_input (gui_current_window->buffer, 0); - gui_input_optimize_buffer_size (gui_current_window->buffer); - gui_current_window->buffer->completion.position = -1; + gui_input_clipboard_copy(gui_current_window->buffer->input_buffer + + gui_current_window->buffer->input_buffer_pos, + gui_current_window->buffer->input_buffer_size - + gui_current_window->buffer->input_buffer_pos); + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] = ' '; + gui_current_window->buffer->input_buffer_size = gui_current_window->buffer->input_buffer_pos ; + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; + gui_draw_buffer_input (gui_current_window->buffer, 0); + gui_input_optimize_buffer_size (gui_current_window->buffer); + gui_current_window->buffer->completion.position = -1; } /* diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 069f51893..288096021 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -1,10 +1,12 @@ WeeChat - Wee Enhanced Environment for Chat =========================================== -ChangeLog - 2005-07-13 +ChangeLog - 2005-07-14 Version 0.1.4 (under dev!): + * fixed SIGSEGV handler (now write a core file by aborting program) + * fixed statusbar & infobar background refresh problem with some systems * added color for private in hotlist (different than color for highlight) * added DCC resume and timeout * added function for Perl/Python to get DCC list diff --git a/weechat/src/common/weechat.c b/weechat/src/common/weechat.c index c3f9a8352..625ae7eef 100644 --- a/weechat/src/common/weechat.c +++ b/weechat/src/common/weechat.c @@ -373,50 +373,50 @@ wee_parse_args (int argc, char *argv[]) || (strcmp (argv[i], "--config") == 0)) { wee_display_config_options (); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-f") == 0) || (strcmp (argv[i], "--key-functions") == 0)) { wee_display_key_functions (); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-h") == 0) || (strcmp (argv[i], "--help") == 0)) { printf ("\n" WEE_USAGE1, argv[0], argv[0]); printf ("%s", WEE_USAGE2); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-i") == 0) || (strcmp (argv[i], "--irc-commands") == 0)) { wee_display_commands (0, 1); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-k") == 0) || (strcmp (argv[i], "--keys") == 0)) { wee_display_keys (); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-l") == 0) || (strcmp (argv[i], "--license") == 0)) { printf ("\n%s%s", WEE_LICENSE); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-v") == 0) || (strcmp (argv[i], "--version") == 0)) { printf (PACKAGE_VERSION "\n"); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strcmp (argv[i], "-w") == 0) || (strcmp (argv[i], "--weechat-commands") == 0)) { wee_display_commands (1, 0); - wee_shutdown (EXIT_SUCCESS); + wee_shutdown (EXIT_SUCCESS, 0); } else if ((strncasecmp (argv[i], "irc", 3) == 0)) { @@ -492,7 +492,7 @@ wee_create_home_dirs () { fprintf (stderr, _("%s unable to get HOME directory\n"), WEECHAT_ERROR); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 0); } dir_length = strlen (ptr_home) + 10; weechat_home = @@ -501,7 +501,7 @@ wee_create_home_dirs () { fprintf (stderr, _("%s not enough memory for home directory\n"), WEECHAT_ERROR); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 0); } snprintf (weechat_home, dir_length, "%s%s.weechat", ptr_home, DIR_SEPARATOR); @@ -511,7 +511,7 @@ wee_create_home_dirs () { fprintf (stderr, _("%s unable to create ~/.weechat directory\n"), WEECHAT_ERROR); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 0); } dir_length = strlen (weechat_home) + 64; @@ -581,11 +581,11 @@ wee_init_vars () msgq_last_msg = NULL; /* init gnutls */ - #ifdef HAVE_GNUTLS +#ifdef HAVE_GNUTLS gnutls_global_init (); gnutls_certificate_allocate_credentials (&gnutls_xcred); gnutls_certificate_set_x509_trust_file (gnutls_xcred, "ca.pem", GNUTLS_X509_FMT_PEM); - #endif +#endif } /* @@ -669,7 +669,7 @@ wee_gui_shutdown () */ void -wee_shutdown (int return_code) +wee_shutdown (int return_code, int crash) { fifo_remove (); if (weechat_home) @@ -680,12 +680,15 @@ wee_shutdown (int return_code) free (local_charset); alias_free_all (); - #ifdef HAVE_GNUTLS +#ifdef HAVE_GNUTLS gnutls_certificate_free_credentials (gnutls_xcred); gnutls_global_deinit(); - #endif +#endif - exit (return_code); + if (crash) + abort(); + else + exit (return_code); } /* @@ -776,17 +779,6 @@ wee_dump (int crash) } /* - * my_sigint: SIGINT handler, do nothing (just ignore this signal) - * Prevents user for exiting with Ctrl-C - */ - -void -my_sigint () -{ - /* do nothing */ -} - -/* * my_sigsegv: SIGSEGV handler: save crash log to ~/.weechat/weechat.log and exit */ @@ -801,7 +793,7 @@ my_sigsegv () fprintf (stderr, "*** Please send this file to WeeChat developers.\n"); fprintf (stderr, "*** (be careful, private info may be in this file since\n"); fprintf (stderr, "*** part of chats are displayed, so remove lines if needed)\n\n"); - wee_shutdown (EXIT_FAILURE); + wee_shutdown (EXIT_FAILURE, 1); } /* @@ -821,7 +813,7 @@ main (int argc, char *argv[]) local_charset = strdup (nl_langinfo (CODESET)); #endif - signal (SIGINT, my_sigint); /* ignore SIGINT signal */ + signal (SIGINT, SIG_IGN); /* ignore SIGINT signal */ signal (SIGSEGV, my_sigsegv); /* crash dump when SIGSEGV is received */ gui_pre_init (&argc, &argv); /* pre-initiliaze interface */ wee_init_vars (); /* initialize some variables */ @@ -860,7 +852,7 @@ main (int argc, char *argv[]) (void) config_write (NULL); /* save config file */ command_index_free (); /* free commands index */ wee_gui_shutdown (); /* shut down WeeChat GUI */ - wee_shutdown (EXIT_SUCCESS); /* quit WeeChat (oh no, why?) */ + wee_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */ return EXIT_SUCCESS; /* make gcc happy (never executed) */ } diff --git a/weechat/src/common/weechat.h b/weechat/src/common/weechat.h index 569ba7728..9304671a8 100644 --- a/weechat/src/common/weechat.h +++ b/weechat/src/common/weechat.h @@ -122,6 +122,6 @@ extern void wee_log_printf (char *, ...); extern void wee_dump (int); extern char *weechat_convert_encoding (char *, char *, char *); extern long get_timeval_diff (struct timeval *, struct timeval *); -extern void wee_shutdown (int); +extern void wee_shutdown (int, int); #endif /* weechat.h */ diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c index 9d8b54bb9..7a215a478 100644 --- a/weechat/src/gui/curses/gui-display.c +++ b/weechat/src/gui/curses/gui-display.c @@ -1082,11 +1082,14 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase) for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { + if (has_colors ()) + wbkgdset(ptr_win->win_status, ' ' | COLOR_PAIR (COLOR_WIN_STATUS)); + if (erase) gui_curses_window_clear (ptr_win->win_status); gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); - wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); + /* wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */ wmove (ptr_win->win_status, 0, 0); /* display number of buffers */ @@ -1407,15 +1410,14 @@ gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase) for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) { + if (has_colors ()) + wbkgdset(ptr_win->win_infobar, ' ' | COLOR_PAIR (COLOR_WIN_INFOBAR)); + if (erase) gui_curses_window_clear (ptr_win->win_infobar); - if (has_colors ()) - { - gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR); - wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); - wnoutrefresh (ptr_win->win_infobar); - } + gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR); + /* wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '); */ wmove (ptr_win->win_infobar, 0, 0); time_seconds = time (NULL); diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c index 7eeb4bfed..2cb5a6fb2 100644 --- a/weechat/src/gui/gui-common.c +++ b/weechat/src/gui/gui-common.c @@ -1009,20 +1009,16 @@ gui_input_delete_begin_of_line () void gui_input_delete_end_of_line () { - if (gui_current_window->buffer->input_buffer_pos > 0) - { - gui_input_clipboard_copy(gui_current_window->buffer->input_buffer + - gui_current_window->buffer->input_buffer_pos, - gui_current_window->buffer->input_buffer_size - - gui_current_window->buffer->input_buffer_pos); - } - - gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] = ' '; - gui_current_window->buffer->input_buffer_size = gui_current_window->buffer->input_buffer_pos ; - gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; - gui_draw_buffer_input (gui_current_window->buffer, 0); - gui_input_optimize_buffer_size (gui_current_window->buffer); - gui_current_window->buffer->completion.position = -1; + gui_input_clipboard_copy(gui_current_window->buffer->input_buffer + + gui_current_window->buffer->input_buffer_pos, + gui_current_window->buffer->input_buffer_size - + gui_current_window->buffer->input_buffer_pos); + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] = ' '; + gui_current_window->buffer->input_buffer_size = gui_current_window->buffer->input_buffer_pos ; + gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0'; + gui_draw_buffer_input (gui_current_window->buffer, 0); + gui_input_optimize_buffer_size (gui_current_window->buffer); + gui_current_window->buffer->completion.position = -1; } /* |