diff options
-rw-r--r-- | libbb/lineedit.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 6c91f1794..2566abd38 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -679,6 +679,14 @@ static void add_match(char *matched) | |||
679 | num_matches++; | 679 | num_matches++; |
680 | } | 680 | } |
681 | 681 | ||
682 | #if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1 | ||
683 | static void add_partial_match(const char *part, const char *full, int plen) | ||
684 | { | ||
685 | if (strncmp(part, full, plen) == 0) | ||
686 | add_match(xstrdup(full)); | ||
687 | } | ||
688 | #endif | ||
689 | |||
682 | # if ENABLE_FEATURE_USERNAME_COMPLETION | 690 | # if ENABLE_FEATURE_USERNAME_COMPLETION |
683 | /* Replace "~user/..." with "/homedir/...". | 691 | /* Replace "~user/..." with "/homedir/...". |
684 | * The parameter is malloced, free it or return it | 692 | * The parameter is malloced, free it or return it |
@@ -826,15 +834,15 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type) | |||
826 | pf_len = strlen(pfind); | 834 | pf_len = strlen(pfind); |
827 | 835 | ||
828 | #if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1 | 836 | #if ENABLE_FEATURE_SH_STANDALONE && NUM_APPLETS != 1 |
829 | if (type == FIND_EXE_ONLY) { | 837 | if (type == FIND_EXE_ONLY && dirbuf == NULL) { |
830 | const char *p = applet_names; | 838 | const char *p = applet_names; |
831 | 839 | ||
832 | while (*p) { | 840 | while (*p) { |
833 | if (strncmp(pfind, p, pf_len) == 0) | 841 | add_partial_match(pfind, p, pf_len); |
834 | add_match(xstrdup(p)); | ||
835 | while (*p++ != '\0') | 842 | while (*p++ != '\0') |
836 | continue; | 843 | continue; |
837 | } | 844 | } |
845 | add_partial_match(pfind, "busybox", pf_len); | ||
838 | } | 846 | } |
839 | #endif | 847 | #endif |
840 | 848 | ||