[PATCH] lineedit: use stdout for shell history builtin

Ron Yorston rmy at pobox.com
Sat Jul 27 06:51:35 UTC 2024


Commit fd47f0567 (lineedit: print prompt and editing operations
to stderr) changed various print statements to output to stderr.
The change in show_history() caused the shell history builtin to
send its output to stderr.

Revert that part of the commit.

function                                             old     new   delta
show_history                                          47      42      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5)               Total: -5 bytes

Signed-off-by: Ron Yorston <rmy at pobox.com>
---
 libbb/lineedit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 543a3f11c..3e06a4bc5 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1463,7 +1463,7 @@ void FAST_FUNC show_history(const line_input_t *st)
 	if (!st)
 		return;
 	for (i = 0; i < st->cnt_history; i++)
-		fprintf(stderr, "%4d %s\n", i, st->history[i]);
+		printf("%4d %s\n", i, st->history[i]);
 }
 
 # if ENABLE_FEATURE_EDITING_SAVEHISTORY
-- 
2.45.2



More information about the busybox mailing list