1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-24 20:06:38 +02:00

- fixed SIGSEGV handler (now write a core file by aborting program)

- fixed statusbar & infobar background refresh problem with some systems
This commit is contained in:
Sebastien Helleu
2005-07-14 07:04:45 +00:00
parent 1d07964d17
commit a9912cd266
10 changed files with 92 additions and 108 deletions
+3 -1
View File
@@ -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
+23 -31
View File
@@ -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);
}
/*
@@ -775,17 +778,6 @@ wee_dump (int crash)
wee_log_printf ("\n");
}
/*
* 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) */
}
+1 -1
View File
@@ -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 */
+9 -7
View File
@@ -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);
+10 -14
View File
@@ -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;
}
/*
+3 -1
View File
@@ -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
+23 -31
View File
@@ -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);
}
/*
@@ -775,17 +778,6 @@ wee_dump (int crash)
wee_log_printf ("\n");
}
/*
* 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) */
}
+1 -1
View File
@@ -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 */
+9 -7
View File
@@ -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);
+10 -14
View File
@@ -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;
}
/*