From 195902a645b794092959ac3818f367104c7ffeb8 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Sat, 8 Dec 2018 15:45:44 +0000 Subject: lineedit: improvements to tab completion Since getpwent isn't implemented for WIN32 there's no point in enabling FEATURE_USERNAME_COMPLETION. Use case-insensitive comparisons when matching filenames. The code to exclude non-executables when tab completing executables is WIN32-specific and shouldn't omit directories. --- libbb/compare_string_array.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'libbb/compare_string_array.c') 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) #endif } +#if ENABLE_PLATFORM_MINGW32 +char* FAST_FUNC is_prefixed_with_case(const char *string, const char *key) +{ + while (*key != '\0') { + if (tolower(*key) != tolower(*string)) + return NULL; + key++; + string++; + } + return (char*)string; +} +#endif + /* * Return NULL if string is not suffixed with key. Return pointer to the * beginning of prefix key in string. If key is an empty string return pointer -- cgit v1.2.3-55-g6feb