[git commit] vi: rearrange functions, no logic changes

Denys Vlasenko vda.linux at googlemail.com
Mon Apr 1 12:02:37 UTC 2019


commit: https://git.busybox.net/busybox/commit/?id=616e4699d2d54518b6bdf5534a8b81bed9e63e77
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 editors/vi.c | 84 ++++++++++++++++++++++++++++++------------------------------
 1 file changed, 42 insertions(+), 42 deletions(-)

diff --git a/editors/vi.c b/editors/vi.c
index cfb1a71ea..e960afc37 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2444,48 +2444,6 @@ static void cookmode(void)
 	tcsetattr_stdin_TCSANOW(&term_orig);
 }
 
-#if ENABLE_FEATURE_VI_USE_SIGNALS
-static void winch_handler(int sig UNUSED_PARAM)
-{
-	int save_errno = errno;
-	// FIXME: do it in main loop!!!
-	signal(SIGWINCH, winch_handler);
-	query_screen_dimensions();
-	new_screen(rows, columns);	// get memory for virtual screen
-	redraw(TRUE);		// re-draw the screen
-	errno = save_errno;
-}
-static void tstp_handler(int sig UNUSED_PARAM)
-{
-	int save_errno = errno;
-
-	// ioctl inside cookmode() was seen to generate SIGTTOU,
-	// stopping us too early. Prevent that:
-	signal(SIGTTOU, SIG_IGN);
-
-	go_bottom_and_clear_to_eol();
-	cookmode(); // terminal to "cooked"
-
-	// stop now
-	//signal(SIGTSTP, SIG_DFL);
-	//raise(SIGTSTP);
-	raise(SIGSTOP); // avoid "dance" with TSTP handler - use SIGSTOP instead
-	//signal(SIGTSTP, tstp_handler);
-
-	// we have been "continued" with SIGCONT, restore screen and termios
-	rawmode(); // terminal to "raw"
-	last_status_cksum = 0; // force status update
-	redraw(TRUE); // re-draw the screen
-
-	errno = save_errno;
-}
-static void int_handler(int sig)
-{
-	signal(SIGINT, int_handler);
-	siglongjmp(restart, sig);
-}
-#endif /* FEATURE_VI_USE_SIGNALS */
-
 static int mysleep(int hund)	// sleep for 'hund' 1/100 seconds or stdin ready
 {
 	struct pollfd pfd[1];
@@ -3103,6 +3061,48 @@ static void refresh(int full_screen)
 #undef old_offset
 }
 
+#if ENABLE_FEATURE_VI_USE_SIGNALS
+static void winch_handler(int sig UNUSED_PARAM)
+{
+	int save_errno = errno;
+	// FIXME: do it in main loop!!!
+	signal(SIGWINCH, winch_handler);
+	query_screen_dimensions();
+	new_screen(rows, columns);	// get memory for virtual screen
+	redraw(TRUE);		// re-draw the screen
+	errno = save_errno;
+}
+static void tstp_handler(int sig UNUSED_PARAM)
+{
+	int save_errno = errno;
+
+	// ioctl inside cookmode() was seen to generate SIGTTOU,
+	// stopping us too early. Prevent that:
+	signal(SIGTTOU, SIG_IGN);
+
+	go_bottom_and_clear_to_eol();
+	cookmode(); // terminal to "cooked"
+
+	// stop now
+	//signal(SIGTSTP, SIG_DFL);
+	//raise(SIGTSTP);
+	raise(SIGSTOP); // avoid "dance" with TSTP handler - use SIGSTOP instead
+	//signal(SIGTSTP, tstp_handler);
+
+	// we have been "continued" with SIGCONT, restore screen and termios
+	rawmode(); // terminal to "raw"
+	last_status_cksum = 0; // force status update
+	redraw(TRUE); // re-draw the screen
+
+	errno = save_errno;
+}
+static void int_handler(int sig)
+{
+	signal(SIGINT, int_handler);
+	siglongjmp(restart, sig);
+}
+#endif /* FEATURE_VI_USE_SIGNALS */
+
 static void do_cmd(int c);
 
 static int find_range(char **start, char **stop, char c)


More information about the busybox-cvs mailing list