From 56e7ec2edacc18f3b323a35544dc577545eb24d4 Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 9 Sep 2004 16:06:52 +0000 Subject: use Signal instead of signal, and define the correct one in osdep.h fix compile error git-svn-id: http://opensvn.csie.org/pttbbs/branches/victor.solaris@2188 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/brc.c | 2 +- mbbsd/chc.c | 6 +++--- mbbsd/mbbsd.c | 36 ++++++++++++++++++------------------ mbbsd/osdep.c | 18 ++++++++++++++++++ mbbsd/term.c | 6 +++--- 5 files changed, 43 insertions(+), 25 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/brc.c b/mbbsd/brc.c index 4233ea59..7bff2787 100644 --- a/mbbsd/brc.c +++ b/mbbsd/brc.c @@ -97,7 +97,7 @@ brc_find_record(int bid, int *num) { char *p; brcnbrd_t tnum; - ptr = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, &tnum); + p = brc_findrecord_in(brc_buf, brc_buf + brc_size, bid, &tnum); *num = tnum; if (p) return (time_t*)(p + sizeof(brcbid_t) + sizeof(brcnbrd_t)); diff --git a/mbbsd/chc.c b/mbbsd/chc.c index 54a351ba..4a37dbfe 100644 --- a/mbbsd/chc.c +++ b/mbbsd/chc.c @@ -896,7 +896,7 @@ chc_init(int s, chcusr_t *user1, chcusr_t *user2, board_t board, play_func_t pla chc_redraw(user1, user2, board); add_io(s, 0); - signal(SIGUSR1, chc_watch_request); + Signal(SIGUSR1, chc_watch_request); if (my->turn && !(chc_mode & CHC_WATCH)) chc_broadcast_recv(act_list, board); @@ -926,7 +926,7 @@ chc(int s, int mode) char mode0 = currutmp->mode; char file[80]; - signal(SIGUSR1, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); chc_mode = mode; chc_bp = &board; @@ -963,7 +963,7 @@ chc(int s, int mode) } else chc_log_close(); - signal(SIGUSR1, talk_request); + Signal(SIGUSR1, talk_request); } static userinfo_t * diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 4b343466..eb6ae50f 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1007,17 +1007,17 @@ start_client() login_start_time = time(0); currmode = 0; - signal(SIGHUP, abort_bbs); - signal(SIGTERM, abort_bbs); - signal(SIGPIPE, abort_bbs); - - signal(SIGINT, abort_bbs_debug); - signal(SIGQUIT, abort_bbs_debug); - signal(SIGILL, abort_bbs_debug); - signal(SIGABRT, abort_bbs_debug); - signal(SIGFPE, abort_bbs_debug); - signal(SIGBUS, abort_bbs_debug); - signal(SIGSEGV, abort_bbs_debug); + Signal(SIGHUP, abort_bbs); + Signal(SIGTERM, abort_bbs); + Signal(SIGPIPE, abort_bbs); + + Signal(SIGINT, abort_bbs_debug); + Signal(SIGQUIT, abort_bbs_debug); + Signal(SIGILL, abort_bbs_debug); + Signal(SIGABRT, abort_bbs_debug); + Signal(SIGFPE, abort_bbs_debug); + Signal(SIGBUS, abort_bbs_debug); + Signal(SIGSEGV, abort_bbs_debug); signal_restart(SIGUSR1, talk_request); signal_restart(SIGUSR2, write_request); @@ -1029,7 +1029,7 @@ start_client() exit(1); do_term_init(); - signal(SIGALRM, abort_bbs); + Signal(SIGALRM, abort_bbs); alarm(600); login_query(); /* Ptt 加上login time out */ @@ -1042,7 +1042,7 @@ start_client() b_closepolls(); SHM->close_vote_time = now; } - signal(SIGALRM, SIG_IGN); + Signal(SIGALRM, SIG_IGN); domenu(MMENU, "主功\能表", (currutmp->mailalert ? 'M' : 'C'), cmdlist); } @@ -1122,7 +1122,7 @@ getremotename(struct sockaddr_in * from, char *rhost, char *rname) hp = NULL; if (setjmp(byebye) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(3); hp = gethostbyaddr((char *)&from->sin_addr, sizeof(struct in_addr), from->sin_family); @@ -1153,7 +1153,7 @@ getremotename(struct sockaddr_in * from, char *rhost, char *rname) } /* Set up a timer so we won't get stuck while waiting for the server. */ if (setjmp(byebye) == 0) { - signal(SIGALRM, timeout); + Signal(SIGALRM, timeout); alarm(RFC931_TIMEOUT); /* @@ -1251,11 +1251,11 @@ main(int argc, char *argv[], char *envp[]) start_time = time(NULL); /* avoid SIGPIPE */ - signal(SIGPIPE, SIG_IGN); + Signal(SIGPIPE, SIG_IGN); /* avoid erroneous signal from other mbbsd */ - signal(SIGUSR1, SIG_IGN); - signal(SIGUSR2, SIG_IGN); + Signal(SIGUSR1, SIG_IGN); + Signal(SIGUSR2, SIG_IGN); attach_SHM(); if( (argc == 3 && shell_login(argc, argv, envp)) || diff --git a/mbbsd/osdep.c b/mbbsd/osdep.c index e7852177..1bca7208 100644 --- a/mbbsd/osdep.c +++ b/mbbsd/osdep.c @@ -380,6 +380,24 @@ inet_pton(int af, const char *src, void *dst) } #endif +#ifdef NEED_BSD_SIGNAL + +void (*bsd_signal(int sig, void (*func)(int)))(int) +{ + struct sigaction act, oact; + + act.sa_handler = func; + act.sa_flags = SA_RESTART; + sigemptyset(&act.sa_mask); + sigaddset(&act.sa_mask, sig); + if (sigaction(sig, &act, &oact) == -1) + return(SIG_ERR); + return(oact.sa_handler); +} + + +#endif + #ifdef Solaris diff --git a/mbbsd/term.c b/mbbsd/term.c index 555840d1..9d766fe4 100644 --- a/mbbsd/term.c +++ b/mbbsd/term.c @@ -58,7 +58,7 @@ term_resize(int sig) struct winsize newsize; screenline_t *new_picture; - signal(SIGWINCH, SIG_IGN); /* Don't bother me! */ + Signal(SIGWINCH, SIG_IGN); /* Don't bother me! */ ioctl(0, TIOCGWINSZ, &newsize); /* make sure reasonable size */ @@ -82,13 +82,13 @@ term_resize(int sig) b_lines = t_lines - 1; p_lines = t_lines - 4; - signal(SIGWINCH, term_resize); + Signal(SIGWINCH, term_resize); } int term_init() { - signal(SIGWINCH, term_resize); + Signal(SIGWINCH, term_resize); return YEA; } -- cgit v1.2.3