Consistently use SIGNAL_HANDLER() macro to define signal handler functions
With this change, the signal handler signature is defined in only one place. Also make most signal handler functions static (those that are only referred to in irc.c).
This commit is contained in:
@@ -160,12 +160,12 @@ typedef int socklen_t;
|
|||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
typedef RETSIGTYPE sigfunc (int);
|
|
||||||
sigfunc *my_signal (int, sigfunc *, int);
|
|
||||||
|
|
||||||
#define SIGNAL_HANDLER(x) \
|
#define SIGNAL_HANDLER(x) \
|
||||||
RETSIGTYPE x (int unused)
|
RETSIGTYPE x (int unused)
|
||||||
|
|
||||||
|
typedef SIGNAL_HANDLER(sigfunc);
|
||||||
|
sigfunc *my_signal (int, sigfunc *, int);
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define index strchr
|
#define index strchr
|
||||||
|
|
||||||
|
|||||||
@@ -709,7 +709,7 @@ extern char default_pair[2];
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RETSIGTYPE term_cont (int);
|
SIGNAL_HANDLER(term_cont);
|
||||||
void term_beep (void);
|
void term_beep (void);
|
||||||
int term_echo (int);
|
int term_echo (int);
|
||||||
int term_init (char *);
|
int term_init (char *);
|
||||||
|
|||||||
@@ -40,7 +40,6 @@
|
|||||||
void window_redirect (char *, int);
|
void window_redirect (char *, int);
|
||||||
void redraw_resized (Window *, ShrinkInfo, int);
|
void redraw_resized (Window *, ShrinkInfo, int);
|
||||||
void close_all_screen (void);
|
void close_all_screen (void);
|
||||||
RETSIGTYPE sig_refresh_screen (int);
|
|
||||||
int check_screen_redirect (char *);
|
int check_screen_redirect (char *);
|
||||||
void BX_kill_screen (Screen *);
|
void BX_kill_screen (Screen *);
|
||||||
ShrinkInfo resize_display (Window *);
|
ShrinkInfo resize_display (Window *);
|
||||||
|
|||||||
20
source/irc.c
20
source/irc.c
@@ -350,16 +350,14 @@ void reset_clock(Window *win, char *unused, int unused1)
|
|||||||
update_all_status(win, NULL, 0);
|
update_all_status(win, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* sig_refresh_screen: the signal-callable version of refresh_screen */
|
/* sig_refresh_screen: the signal-callable version of refresh_screen */
|
||||||
SIGNAL_HANDLER(sig_refresh_screen)
|
static SIGNAL_HANDLER(sig_refresh_screen)
|
||||||
{
|
{
|
||||||
refresh_screen(0, NULL);
|
refresh_screen(0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* irc_exit: cleans up and leaves */
|
/* irc_exit: cleans up and leaves */
|
||||||
SIGNAL_HANDLER(irc_exit_old)
|
static SIGNAL_HANDLER(irc_exit_old)
|
||||||
{
|
{
|
||||||
irc_exit(1,NULL, NULL);
|
irc_exit(1,NULL, NULL);
|
||||||
}
|
}
|
||||||
@@ -377,7 +375,7 @@ SIGNAL_HANDLER(child_reap)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
SIGNAL_HANDLER(nothing)
|
static SIGNAL_HANDLER(nothing)
|
||||||
{
|
{
|
||||||
/* nothing to do! */
|
/* nothing to do! */
|
||||||
}
|
}
|
||||||
@@ -390,11 +388,11 @@ static int sigpipe_hit = 0;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
SIGNAL_HANDLER(sigusr2)
|
static SIGNAL_HANDLER(sigusr2)
|
||||||
{
|
{
|
||||||
mtrace();
|
mtrace();
|
||||||
}
|
}
|
||||||
SIGNAL_HANDLER(sigusr3)
|
static SIGNAL_HANDLER(sigusr3)
|
||||||
{
|
{
|
||||||
muntrace();
|
muntrace();
|
||||||
}
|
}
|
||||||
@@ -467,7 +465,7 @@ void BX_irc_exit (int really_quit, char *reason, char *format, ...)
|
|||||||
volatile int segv_recurse = 0;
|
volatile int segv_recurse = 0;
|
||||||
/* sigsegv: something to handle segfaults in a nice way */
|
/* sigsegv: something to handle segfaults in a nice way */
|
||||||
/* this needs to be changed to *NOT* use printf(). */
|
/* this needs to be changed to *NOT* use printf(). */
|
||||||
SIGNAL_HANDLER(coredump)
|
static SIGNAL_HANDLER(coredump)
|
||||||
{
|
{
|
||||||
#if defined(WINNT)
|
#if defined(WINNT)
|
||||||
extern char *sys_siglist[];
|
extern char *sys_siglist[];
|
||||||
@@ -519,7 +517,7 @@ void irc_quit(char key, char * ptr)
|
|||||||
* cntl_c: emergency exit.... if somehow everything else freezes up, hitting
|
* cntl_c: emergency exit.... if somehow everything else freezes up, hitting
|
||||||
* ^C five times should kill the program.
|
* ^C five times should kill the program.
|
||||||
*/
|
*/
|
||||||
SIGNAL_HANDLER(cntl_c)
|
static SIGNAL_HANDLER(cntl_c)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (cntl_c_hit++ >= 4)
|
if (cntl_c_hit++ >= 4)
|
||||||
@@ -528,7 +526,7 @@ SIGNAL_HANDLER(cntl_c)
|
|||||||
kill(getpid(), SIGALRM);
|
kill(getpid(), SIGALRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
SIGNAL_HANDLER(sig_user1)
|
static SIGNAL_HANDLER(sig_user1)
|
||||||
{
|
{
|
||||||
bitchsay("Got SIGUSR1, closing DCC connections and EXECed processes");
|
bitchsay("Got SIGUSR1, closing DCC connections and EXECed processes");
|
||||||
close_all_dcc();
|
close_all_dcc();
|
||||||
@@ -536,7 +534,7 @@ SIGNAL_HANDLER(sig_user1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SIGNAL_HANDLER(sig_detach)
|
static SIGNAL_HANDLER(sig_detach)
|
||||||
{
|
{
|
||||||
detachcmd(NULL, NULL, NULL, NULL);
|
detachcmd(NULL, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user