aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-02 14:19:51 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-02 14:19:51 +0100
commit8131eea3dce5fba0dfb78e6083d1730423fad20b (patch)
treec098d7ba6ef9f4745425a29a330480e6088d6d9a /libbb/lineedit.c
parent0d8ea64af618dc83c3291b3b598636ed3d0854e4 (diff)
downloadbusybox-w32-8131eea3dce5fba0dfb78e6083d1730423fad20b.tar.gz
busybox-w32-8131eea3dce5fba0dfb78e6083d1730423fad20b.tar.bz2
busybox-w32-8131eea3dce5fba0dfb78e6083d1730423fad20b.zip
*: 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 <vda.linux@googlemail.com>
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 0f7ab8c94..a9972576e 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -373,7 +373,7 @@ static void input_backward(unsigned num)
373static void put_prompt(void) 373static void put_prompt(void)
374{ 374{
375 out1str(cmdedit_prompt); 375 out1str(cmdedit_prompt);
376 fflush(NULL); 376 fflush_all();
377#if ENABLE_FEATURE_EDITING_ASK_TERMINAL 377#if ENABLE_FEATURE_EDITING_ASK_TERMINAL
378 { 378 {
379 /* Ask terminal where is the cursor now. 379 /* Ask terminal where is the cursor now.
@@ -411,7 +411,7 @@ static void put_prompt(void)
411 if (safe_poll(&pfd, 1, 0) == 0) { 411 if (safe_poll(&pfd, 1, 0) == 0) {
412 S.sent_ESC_br6n = 1; 412 S.sent_ESC_br6n = 1;
413 out1str("\033" "[6n"); 413 out1str("\033" "[6n");
414 fflush(NULL); /* make terminal see it ASAP! */ 414 fflush_all(); /* make terminal see it ASAP! */
415 } 415 }
416 } 416 }
417#endif 417#endif
@@ -1636,7 +1636,7 @@ static void cmdedit_setwidth(unsigned w, int redraw_flg)
1636 int new_y = (cursor + cmdedit_prmt_len) / w; 1636 int new_y = (cursor + cmdedit_prmt_len) / w;
1637 /* redraw */ 1637 /* redraw */
1638 redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor); 1638 redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor);
1639 fflush(NULL); 1639 fflush_all();
1640 } 1640 }
1641} 1641}
1642 1642
@@ -1748,7 +1748,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
1748 ) { 1748 ) {
1749 /* Happens when e.g. stty -echo was run before */ 1749 /* Happens when e.g. stty -echo was run before */
1750 parse_and_put_prompt(prompt); 1750 parse_and_put_prompt(prompt);
1751 /* fflush(stdout); - done by parse_and_put_prompt */ 1751 /* fflush_all(); - done by parse_and_put_prompt */
1752 if (fgets(command, maxsize, stdin) == NULL) 1752 if (fgets(command, maxsize, stdin) == NULL)
1753 len = -1; /* EOF or error */ 1753 len = -1; /* EOF or error */
1754 else 1754 else
@@ -1841,7 +1841,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
1841 }; 1841 };
1842 int32_t ic, ic_raw; 1842 int32_t ic, ic_raw;
1843 1843
1844 fflush(NULL); 1844 fflush_all();
1845 ic = ic_raw = lineedit_read_key(read_key_buffer); 1845 ic = ic_raw = lineedit_read_key(read_key_buffer);
1846 1846
1847#if ENABLE_FEATURE_EDITING_VI 1847#if ENABLE_FEATURE_EDITING_VI
@@ -2245,7 +2245,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2245 tcsetattr_stdin_TCSANOW(&initial_settings); 2245 tcsetattr_stdin_TCSANOW(&initial_settings);
2246 /* restore SIGWINCH handler */ 2246 /* restore SIGWINCH handler */
2247 signal(SIGWINCH, previous_SIGWINCH_handler); 2247 signal(SIGWINCH, previous_SIGWINCH_handler);
2248 fflush(NULL); 2248 fflush_all();
2249 2249
2250 len = command_len; 2250 len = command_len;
2251 DEINIT_S(); 2251 DEINIT_S();
@@ -2259,7 +2259,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li
2259int FAST_FUNC read_line_input(const char* prompt, char* command, int maxsize) 2259int FAST_FUNC read_line_input(const char* prompt, char* command, int maxsize)
2260{ 2260{
2261 fputs(prompt, stdout); 2261 fputs(prompt, stdout);
2262 fflush(NULL); 2262 fflush_all();
2263 fgets(command, maxsize, stdin); 2263 fgets(command, maxsize, stdin);
2264 return strlen(command); 2264 return strlen(command);
2265} 2265}