From f4c43d4a23c0581f13da63db89d571476269a31f Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 19 May 2016 09:55:31 +0100 Subject: less: hide unsupported signal handling in include file --- include/libbb.h | 5 +++++ miscutils/less.c | 6 ------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index 9a7590edd..9402bb04b 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -484,6 +484,7 @@ enum { + (1LL << SIGUSR2) + 0), }; +#if !ENABLE_PLATFORM_MINGW32 void bb_signals(int sigs, void (*f)(int)) FAST_FUNC; /* Unlike signal() and bb_signals, sets handler with sigaction() * and in a way that while signal handler is run, no other signals @@ -501,6 +502,10 @@ void sig_unblock(int sig) FAST_FUNC; int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC; /* SIG_BLOCK/SIG_UNBLOCK all signals: */ int sigprocmask_allsigs(int how) FAST_FUNC; +#else +#define bb_signals(s, f) +#define kill_myself_with_sig(s) +#endif /* Standard handler which just records signo */ extern smallint bb_got_signal; void record_signo(int signo); /* not FAST_FUNC! */ diff --git a/miscutils/less.c b/miscutils/less.c index 248f3e3f5..f9f6f62d9 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -309,10 +309,8 @@ static void less_exit(int code) { set_tty_cooked(); clear_line(); -#if !ENABLE_PLATFORM_MINGW32 if (code < 0) kill_myself_with_sig(- code); /* does not return */ -#endif exit(code); } @@ -1805,12 +1803,10 @@ static void keypress_process(int keypress) number_process(keypress); } -#if !ENABLE_PLATFORM_MINGW32 static void sig_catcher(int sig) { less_exit(- sig); } -#endif #if ENABLE_FEATURE_LESS_WINCH static void sigwinch_handler(int sig UNUSED_PARAM) @@ -1901,9 +1897,7 @@ int less_main(int argc, char **argv) max_displayed_line -= 2; /* We want to restore term_orig on exit */ -#if !ENABLE_PLATFORM_MINGW32 bb_signals(BB_FATAL_SIGS, sig_catcher); -#endif #if ENABLE_FEATURE_LESS_WINCH signal(SIGWINCH, sigwinch_handler); #endif -- cgit v1.2.3-55-g6feb