aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorRon Yorston via busybox <busybox@busybox.net>2026-02-08 10:16:18 +0000
committerDenys Vlasenko <vda.linux@googlemail.com>2026-02-28 11:25:05 +0100
commitb59b00323181d5d450a92959b9bbfe3585c6786b (patch)
treefa2d5fccac55def07ffd6166bd0757917d5a66a4 /shell
parent599f5dd8fac390c18b79cba4c14c334957605dae (diff)
downloadbusybox-w32-b59b00323181d5d450a92959b9bbfe3585c6786b.tar.gz
busybox-w32-b59b00323181d5d450a92959b9bbfe3585c6786b.tar.bz2
busybox-w32-b59b00323181d5d450a92959b9bbfe3585c6786b.zip
ash: fix help builtin and tab completion of builtins
Commit 56143ea63 (ash: code shrink: eliminate pstrcmp1()) changed the layout of struct builtincmd so the name member points to the start of the name, not the flag in the first element of the string. This broke the help builtin and tab completion of builtins. Remove the unnecessary '+ 1' in ash_command_name() and helpcmd(). ash_command_name 92 91 -1 helpcmd 106 102 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-5) Total: -5 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 19623a9a0..62f185354 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10855,7 +10855,7 @@ ash_command_name(int i)
10855 int n; 10855 int n;
10856 10856
10857 if (/*i >= 0 &&*/ i < ARRAY_SIZE(builtintab)) 10857 if (/*i >= 0 &&*/ i < ARRAY_SIZE(builtintab))
10858 return builtintab[i].name + 1; 10858 return builtintab[i].name;
10859 i -= ARRAY_SIZE(builtintab); 10859 i -= ARRAY_SIZE(builtintab);
10860 10860
10861 for (n = 0; n < CMDTABLESIZE; n++) { 10861 for (n = 0; n < CMDTABLESIZE; n++) {
@@ -14395,7 +14395,7 @@ helpcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
14395 "------------------\n"); 14395 "------------------\n");
14396 for (col = 0, i = 0; i < ARRAY_SIZE(builtintab); i++) { 14396 for (col = 0, i = 0; i < ARRAY_SIZE(builtintab); i++) {
14397 col += out1fmt("%c%s", ((col == 0) ? '\t' : ' '), 14397 col += out1fmt("%c%s", ((col == 0) ? '\t' : ' '),
14398 builtintab[i].name + 1); 14398 builtintab[i].name);
14399 if (col > 60) { 14399 if (col > 60) {
14400 out1fmt("\n"); 14400 out1fmt("\n");
14401 col = 0; 14401 col = 0;