From 8131eea3dce5fba0dfb78e6083d1730423fad20b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 2 Nov 2009 14:19:51 +0100 Subject: *: introduce and use ffulsh_all() function old new delta buffer_fill_and_print 179 196 +17 fflush_all - 9 +9 spawn 87 92 +5 rtcwake_main 455 453 -2 ... alarm_intr 93 84 -9 readcmd 1072 1062 -10 bb_ask 345 333 -12 more_main 845 832 -13 flush_stdout_stderr 42 23 -19 xfflush_stdout 27 - -27 flush_stderr 30 - -30 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397) Total: -366 bytes Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libbb/lineedit.c') diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 0f7ab8c..a997257 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -373,7 +373,7 @@ static void input_backward(unsigned num) static void put_prompt(void) { out1str(cmdedit_prompt); - fflush(NULL); + fflush_all(); #if ENABLE_FEATURE_EDITING_ASK_TERMINAL { /* Ask terminal where is the cursor now. @@ -411,7 +411,7 @@ static void put_prompt(void) if (safe_poll(&pfd, 1, 0) == 0) { S.sent_ESC_br6n = 1; out1str("\033" "[6n"); - fflush(NULL); /* make terminal see it ASAP! */ + fflush_all(); /* make terminal see it ASAP! */ } } #endif @@ -1636,7 +1636,7 @@ static void cmdedit_setwidth(unsigned w, int redraw_flg) int new_y = (cursor + cmdedit_prmt_len) / w; /* redraw */ redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor); - fflush(NULL); + fflush_all(); } } @@ -1748,7 +1748,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li ) { /* Happens when e.g. stty -echo was run before */ parse_and_put_prompt(prompt); - /* fflush(stdout); - done by parse_and_put_prompt */ + /* fflush_all(); - done by parse_and_put_prompt */ if (fgets(command, maxsize, stdin) == NULL) len = -1; /* EOF or error */ else @@ -1841,7 +1841,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li }; int32_t ic, ic_raw; - fflush(NULL); + fflush_all(); ic = ic_raw = lineedit_read_key(read_key_buffer); #if ENABLE_FEATURE_EDITING_VI @@ -2245,7 +2245,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li tcsetattr_stdin_TCSANOW(&initial_settings); /* restore SIGWINCH handler */ signal(SIGWINCH, previous_SIGWINCH_handler); - fflush(NULL); + fflush_all(); len = command_len; DEINIT_S(); @@ -2259,7 +2259,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li int FAST_FUNC read_line_input(const char* prompt, char* command, int maxsize) { fputs(prompt, stdout); - fflush(NULL); + fflush_all(); fgets(command, maxsize, stdin); return strlen(command); } -- cgit v1.1