From a6f8021cd9bea58d69efc2a75ea5e2a3e6c40514 Mon Sep 17 00:00:00 2001 From: Kevin Easton Date: Wed, 14 Aug 2013 14:39:24 +0000 Subject: [PATCH] Fix a couple of compiler warnings in irc.c - two places where the address of an array was tested (always not-NULL) and one unused variable (first_time in io()). The user-visible change here is that the emergency exit QUIT messages (eg "User abort with 5 Ctrl-C's") will be correctly relayed to the local terminal now. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@321 13b04d17-f746-0410-82c6-800466cd88b0 --- Changelog | 2 ++ source/irc.c | 36 +++++++++++++++--------------------- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/Changelog b/Changelog index 5e1b19e..c2c1a09 100644 --- a/Changelog +++ b/Changelog @@ -1,5 +1,7 @@ [Changes 1.2c01] +* Show same message on local terminal as used in emergency exit QUIT. (caf) + * Remove unused XLINK CTCP reply handler. (caf) * Ensure add_socketread() doesn't leak file descriptors. (caf) diff --git a/source/irc.c b/source/irc.c index 60598a9..41c2343 100644 --- a/source/irc.c +++ b/source/irc.c @@ -437,8 +437,7 @@ void BX_irc_exit (int really_quit, char *reason, char *format, ...) close_all_servers(reason ? reason : buffer); - put_it("%s", buffer ? buffer : reason ? reason : empty_string); - + put_it("%s", !format && reason ? reason : buffer); clean_up_processes(); if (!dumb_mode && term_initialized) @@ -1138,7 +1137,7 @@ static char *parse_args (char *argv[], int argc, char **envp) #endif } - if (!nickname || !*nickname) + if (!*nickname) strlcpy(nickname, username, sizeof nickname); if (!check_nickname(nickname)) @@ -1201,23 +1200,19 @@ extern void set_screens (fd_set *, fd_set *); void BX_io (const char *what) { - static int first_time = 1, - level = 0; - long clock_timeout = 0, - timer_timeout = 0, - server_timeout = 0, - real_timeout = 0; -static struct timeval my_now, - my_timer, - *time_ptr = &my_timer; - - int hold_over, - rc; - fd_set rd, - wd; - static int old_level = 0; -static const char *caller[51] = { NULL }; /* XXXX */ - static int last_warn = 0; + static int level = 0; + long clock_timeout = 0, + timer_timeout = 0, + server_timeout = 0, + real_timeout = 0; + static struct timeval my_now, + my_timer, + *time_ptr = &my_timer; + int hold_over, rc; + fd_set rd, wd; + static int old_level = 0; + static const char *caller[51] = { NULL }; /* XXXX */ + static int last_warn = 0; level++; @@ -1304,7 +1299,6 @@ static const char *caller[51] = { NULL }; /* XXXX */ case -1: { /* if we just got a sigint */ - first_time = 0; if (cntl_c_hit) { edit_char('\003');