aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/mingw32_defconfig2
-rw-r--r--configs/mingw64_defconfig2
-rw-r--r--include/mingw.h2
-rw-r--r--libbb/compare_string_array.c13
-rw-r--r--libbb/lineedit.c19
5 files changed, 26 insertions, 12 deletions
diff --git a/configs/mingw32_defconfig b/configs/mingw32_defconfig
index 5a49bc4a8..6ef09c7b9 100644
--- a/configs/mingw32_defconfig
+++ b/configs/mingw32_defconfig
@@ -115,7 +115,7 @@ CONFIG_FEATURE_EDITING_SAVEHISTORY=y
115# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set 115# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
116CONFIG_FEATURE_REVERSE_SEARCH=y 116CONFIG_FEATURE_REVERSE_SEARCH=y
117CONFIG_FEATURE_TAB_COMPLETION=y 117CONFIG_FEATURE_TAB_COMPLETION=y
118CONFIG_FEATURE_USERNAME_COMPLETION=y 118# CONFIG_FEATURE_USERNAME_COMPLETION is not set
119CONFIG_FEATURE_EDITING_FANCY_PROMPT=y 119CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
120# CONFIG_FEATURE_EDITING_WINCH is not set 120# CONFIG_FEATURE_EDITING_WINCH is not set
121# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set 121# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
diff --git a/configs/mingw64_defconfig b/configs/mingw64_defconfig
index 9d6e32104..8cc6b419a 100644
--- a/configs/mingw64_defconfig
+++ b/configs/mingw64_defconfig
@@ -115,7 +115,7 @@ CONFIG_FEATURE_EDITING_SAVEHISTORY=y
115# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set 115# CONFIG_FEATURE_EDITING_SAVE_ON_EXIT is not set
116CONFIG_FEATURE_REVERSE_SEARCH=y 116CONFIG_FEATURE_REVERSE_SEARCH=y
117CONFIG_FEATURE_TAB_COMPLETION=y 117CONFIG_FEATURE_TAB_COMPLETION=y
118CONFIG_FEATURE_USERNAME_COMPLETION=y 118# CONFIG_FEATURE_USERNAME_COMPLETION is not set
119CONFIG_FEATURE_EDITING_FANCY_PROMPT=y 119CONFIG_FEATURE_EDITING_FANCY_PROMPT=y
120# CONFIG_FEATURE_EDITING_WINCH is not set 120# CONFIG_FEATURE_EDITING_WINCH is not set
121# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set 121# CONFIG_FEATURE_EDITING_ASK_TERMINAL is not set
diff --git a/include/mingw.h b/include/mingw.h
index 543172075..a828e6613 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -447,6 +447,8 @@ int kill_SIGTERM_by_handle(HANDLE process, int exit_code);
447 447
448#define find_mount_point(n, s) find_mount_point(n) 448#define find_mount_point(n, s) find_mount_point(n)
449 449
450char *is_prefixed_with_case(const char *string, const char *key) FAST_FUNC;
451
450/* 452/*
451 * helpers 453 * helpers
452 */ 454 */
diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c
index 01a9df0e2..7ccdaef8a 100644
--- a/libbb/compare_string_array.c
+++ b/libbb/compare_string_array.c
@@ -27,6 +27,19 @@ char* FAST_FUNC is_prefixed_with(const char *string, const char *key)
27#endif 27#endif
28} 28}
29 29
30#if ENABLE_PLATFORM_MINGW32
31char* FAST_FUNC is_prefixed_with_case(const char *string, const char *key)
32{
33 while (*key != '\0') {
34 if (tolower(*key) != tolower(*string))
35 return NULL;
36 key++;
37 string++;
38 }
39 return (char*)string;
40}
41#endif
42
30/* 43/*
31 * Return NULL if string is not suffixed with key. Return pointer to the 44 * Return NULL if string is not suffixed with key. Return pointer to the
32 * beginning of prefix key in string. If key is an empty string return pointer 45 * beginning of prefix key in string. If key is an empty string return pointer
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 19b579782..979e0d544 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -681,6 +681,11 @@ static void input_forward(void)
681//Also, perhaps "foo b<TAB> needs to complete to "foo bar" <cursor>, 681//Also, perhaps "foo b<TAB> needs to complete to "foo bar" <cursor>,
682//not "foo bar <cursor>... 682//not "foo bar <cursor>...
683 683
684# if ENABLE_PLATFORM_MINGW32
685/* use case-insensitive comparisons for filenames */
686# define is_prefixed_with(s, k) is_prefixed_with_case(s, k)
687# endif
688
684static void free_tab_completion_data(void) 689static void free_tab_completion_data(void)
685{ 690{
686 if (matches) { 691 if (matches) {
@@ -897,8 +902,11 @@ static NOINLINE unsigned complete_cmd_dir_file(const char *command, int type)
897 if (stat(found, &st) && lstat(found, &st)) 902 if (stat(found, &st) && lstat(found, &st))
898 goto cont; /* hmm, remove in progress? */ 903 goto cont; /* hmm, remove in progress? */
899 904
900 if (type == FIND_EXE_ONLY && !file_is_executable(found)) 905# if ENABLE_PLATFORM_MINGW32
906 if (type == FIND_EXE_ONLY && !S_ISDIR(st.st_mode) &&
907 !file_is_executable(found))
901 goto cont; 908 goto cont;
909# endif
902 910
903 /* Save only name */ 911 /* Save only name */
904 len = strlen(name_found); 912 len = strlen(name_found);
@@ -2005,16 +2013,7 @@ static void parse_and_put_prompt(const char *prmt_ptr)
2005 char *after_home_user; 2013 char *after_home_user;
2006 2014
2007 /* /home/user[/something] -> ~[/something] */ 2015 /* /home/user[/something] -> ~[/something] */
2008#if !ENABLE_PLATFORM_MINGW32
2009 after_home_user = is_prefixed_with(cwd_buf, home_pwd_buf); 2016 after_home_user = is_prefixed_with(cwd_buf, home_pwd_buf);
2010#else
2011 after_home_user = NULL;
2012 l = strlen(home_pwd_buf);
2013 if (l != 0
2014 && strncasecmp(home_pwd_buf, cwd_buf, l) == 0) {
2015 after_home_user = cwd_buf + l;
2016 }
2017#endif
2018 if (after_home_user 2017 if (after_home_user
2019 && (*after_home_user == '/' || *after_home_user == '\0') 2018 && (*after_home_user == '/' || *after_home_user == '\0')
2020 ) { 2019 ) {