diff options
author | Ron Yorston <rmy@pobox.com> | 2016-05-19 09:55:31 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2016-05-19 09:55:31 +0100 |
commit | f4c43d4a23c0581f13da63db89d571476269a31f (patch) | |
tree | d68a0f3683d35198607ed7a3fbac01062b8df6c3 | |
parent | ee8fdaa48da144585aacdf2a34a82f4cbc5dab02 (diff) | |
download | busybox-w32-f4c43d4a23c0581f13da63db89d571476269a31f.tar.gz busybox-w32-f4c43d4a23c0581f13da63db89d571476269a31f.tar.bz2 busybox-w32-f4c43d4a23c0581f13da63db89d571476269a31f.zip |
less: hide unsupported signal handling in include file
-rw-r--r-- | include/libbb.h | 5 | ||||
-rw-r--r-- | 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 { | |||
484 | + (1LL << SIGUSR2) | 484 | + (1LL << SIGUSR2) |
485 | + 0), | 485 | + 0), |
486 | }; | 486 | }; |
487 | #if !ENABLE_PLATFORM_MINGW32 | ||
487 | void bb_signals(int sigs, void (*f)(int)) FAST_FUNC; | 488 | void bb_signals(int sigs, void (*f)(int)) FAST_FUNC; |
488 | /* Unlike signal() and bb_signals, sets handler with sigaction() | 489 | /* Unlike signal() and bb_signals, sets handler with sigaction() |
489 | * and in a way that while signal handler is run, no other signals | 490 | * and in a way that while signal handler is run, no other signals |
@@ -501,6 +502,10 @@ void sig_unblock(int sig) FAST_FUNC; | |||
501 | int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC; | 502 | int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC; |
502 | /* SIG_BLOCK/SIG_UNBLOCK all signals: */ | 503 | /* SIG_BLOCK/SIG_UNBLOCK all signals: */ |
503 | int sigprocmask_allsigs(int how) FAST_FUNC; | 504 | int sigprocmask_allsigs(int how) FAST_FUNC; |
505 | #else | ||
506 | #define bb_signals(s, f) | ||
507 | #define kill_myself_with_sig(s) | ||
508 | #endif | ||
504 | /* Standard handler which just records signo */ | 509 | /* Standard handler which just records signo */ |
505 | extern smallint bb_got_signal; | 510 | extern smallint bb_got_signal; |
506 | void record_signo(int signo); /* not FAST_FUNC! */ | 511 | 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) | |||
309 | { | 309 | { |
310 | set_tty_cooked(); | 310 | set_tty_cooked(); |
311 | clear_line(); | 311 | clear_line(); |
312 | #if !ENABLE_PLATFORM_MINGW32 | ||
313 | if (code < 0) | 312 | if (code < 0) |
314 | kill_myself_with_sig(- code); /* does not return */ | 313 | kill_myself_with_sig(- code); /* does not return */ |
315 | #endif | ||
316 | exit(code); | 314 | exit(code); |
317 | } | 315 | } |
318 | 316 | ||
@@ -1805,12 +1803,10 @@ static void keypress_process(int keypress) | |||
1805 | number_process(keypress); | 1803 | number_process(keypress); |
1806 | } | 1804 | } |
1807 | 1805 | ||
1808 | #if !ENABLE_PLATFORM_MINGW32 | ||
1809 | static void sig_catcher(int sig) | 1806 | static void sig_catcher(int sig) |
1810 | { | 1807 | { |
1811 | less_exit(- sig); | 1808 | less_exit(- sig); |
1812 | } | 1809 | } |
1813 | #endif | ||
1814 | 1810 | ||
1815 | #if ENABLE_FEATURE_LESS_WINCH | 1811 | #if ENABLE_FEATURE_LESS_WINCH |
1816 | static void sigwinch_handler(int sig UNUSED_PARAM) | 1812 | static void sigwinch_handler(int sig UNUSED_PARAM) |
@@ -1901,9 +1897,7 @@ int less_main(int argc, char **argv) | |||
1901 | max_displayed_line -= 2; | 1897 | max_displayed_line -= 2; |
1902 | 1898 | ||
1903 | /* We want to restore term_orig on exit */ | 1899 | /* We want to restore term_orig on exit */ |
1904 | #if !ENABLE_PLATFORM_MINGW32 | ||
1905 | bb_signals(BB_FATAL_SIGS, sig_catcher); | 1900 | bb_signals(BB_FATAL_SIGS, sig_catcher); |
1906 | #endif | ||
1907 | #if ENABLE_FEATURE_LESS_WINCH | 1901 | #if ENABLE_FEATURE_LESS_WINCH |
1908 | signal(SIGWINCH, sigwinch_handler); | 1902 | signal(SIGWINCH, sigwinch_handler); |
1909 | #endif | 1903 | #endif |