diff options
author | Ron Yorston <rmy@pobox.com> | 2022-01-06 07:46:38 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-01-06 07:46:38 +0000 |
commit | b8751bbc9ac24e71fbe1e79c69074b4c87a134d8 (patch) | |
tree | 336d653df8387b9b1d3c6e46caa373c00cb9b2b2 /miscutils/less.c | |
parent | b15f68214da209b5b293039c09c00f490c0cc193 (diff) | |
parent | 6062c0d19bc201cbeb61b8875598cdd7a14a5ae0 (diff) | |
download | busybox-w32-b8751bbc9ac24e71fbe1e79c69074b4c87a134d8.tar.gz busybox-w32-b8751bbc9ac24e71fbe1e79c69074b4c87a134d8.tar.bz2 busybox-w32-b8751bbc9ac24e71fbe1e79c69074b4c87a134d8.zip |
Merge busybox into merge
Fix merge conflict in miscutils/less.c.
Use exit_SUCCESS() where possible.
Diffstat (limited to 'miscutils/less.c')
-rw-r--r-- | miscutils/less.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index 063c4d378..6da991a0e 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -333,7 +333,7 @@ static void print_statusline(const char *str) | |||
333 | } | 333 | } |
334 | 334 | ||
335 | /* Exit the program gracefully */ | 335 | /* Exit the program gracefully */ |
336 | static void less_exit(int code) | 336 | static void restore_tty(void) |
337 | { | 337 | { |
338 | set_tty_cooked(); | 338 | set_tty_cooked(); |
339 | if (!(G.kbd_fd_orig_flags & O_NONBLOCK)) | 339 | if (!(G.kbd_fd_orig_flags & O_NONBLOCK)) |
@@ -343,9 +343,12 @@ static void less_exit(int code) | |||
343 | #else | 343 | #else |
344 | printf(ESC"[?1049l"); | 344 | printf(ESC"[?1049l"); |
345 | #endif | 345 | #endif |
346 | if (code < 0) | 346 | } |
347 | kill_myself_with_sig(- code); /* does not return */ | 347 | |
348 | exit(code); | 348 | static NOINLINE void less_exit(void) |
349 | { | ||
350 | restore_tty(); | ||
351 | exit_SUCCESS(); | ||
349 | } | 352 | } |
350 | 353 | ||
351 | #if (ENABLE_FEATURE_LESS_DASHCMD && ENABLE_FEATURE_LESS_LINENUMS) \ | 354 | #if (ENABLE_FEATURE_LESS_DASHCMD && ENABLE_FEATURE_LESS_LINENUMS) \ |
@@ -949,7 +952,7 @@ static void buffer_print(void) | |||
949 | ) { | 952 | ) { |
950 | i = option_mask32 & FLAG_F ? 0 : cur_fline; | 953 | i = option_mask32 & FLAG_F ? 0 : cur_fline; |
951 | if (max_fline - i <= max_displayed_line) | 954 | if (max_fline - i <= max_displayed_line) |
952 | less_exit(EXIT_SUCCESS); | 955 | less_exit(); |
953 | } | 956 | } |
954 | status_print(); | 957 | status_print(); |
955 | } | 958 | } |
@@ -1186,7 +1189,7 @@ static int64_t getch_nowait(void) | |||
1186 | goto again; | 1189 | goto again; |
1187 | } | 1190 | } |
1188 | /* EOF/error (ssh session got killed etc) */ | 1191 | /* EOF/error (ssh session got killed etc) */ |
1189 | less_exit(EXIT_SUCCESS); | 1192 | less_exit(); |
1190 | } | 1193 | } |
1191 | set_tty_cooked(); | 1194 | set_tty_cooked(); |
1192 | return key64; | 1195 | return key64; |
@@ -1377,7 +1380,7 @@ static void colon_process(void) | |||
1377 | change_file(-1); | 1380 | change_file(-1); |
1378 | break; | 1381 | break; |
1379 | case 'q': | 1382 | case 'q': |
1380 | less_exit(EXIT_SUCCESS); | 1383 | less_exit(); |
1381 | break; | 1384 | break; |
1382 | case 'x': | 1385 | case 'x': |
1383 | change_file(0); | 1386 | change_file(0); |
@@ -1795,7 +1798,7 @@ static void keypress_process(int keypress) | |||
1795 | buffer_line(cur_fline); | 1798 | buffer_line(cur_fline); |
1796 | break; | 1799 | break; |
1797 | case 'q': case 'Q': | 1800 | case 'q': case 'Q': |
1798 | less_exit(EXIT_SUCCESS); | 1801 | less_exit(); |
1799 | break; | 1802 | break; |
1800 | #if ENABLE_FEATURE_LESS_MARKS | 1803 | #if ENABLE_FEATURE_LESS_MARKS |
1801 | case 'm': | 1804 | case 'm': |
@@ -1874,7 +1877,8 @@ static void keypress_process(int keypress) | |||
1874 | #if !ENABLE_PLATFORM_MINGW32 | 1877 | #if !ENABLE_PLATFORM_MINGW32 |
1875 | static void sig_catcher(int sig) | 1878 | static void sig_catcher(int sig) |
1876 | { | 1879 | { |
1877 | less_exit(- sig); | 1880 | restore_tty(); |
1881 | kill_myself_with_sig(sig); /* does not return */ | ||
1878 | } | 1882 | } |
1879 | #endif | 1883 | #endif |
1880 | 1884 | ||