aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-05-11 15:25:59 +0100
committerRon Yorston <rmy@pobox.com>2022-05-11 15:38:01 +0100
commitf637f37e0bd2e295936a7b4836676846693219aa (patch)
treea5e9a82f80ed85a38a7a6d96a41258e64ebf4d8a
parent2cf6277bbbc925f2c6267f5fb10d6c325dc0b1dd (diff)
downloadbusybox-w32-f637f37e0bd2e295936a7b4836676846693219aa.tar.gz
busybox-w32-f637f37e0bd2e295936a7b4836676846693219aa.tar.bz2
busybox-w32-f637f37e0bd2e295936a7b4836676846693219aa.zip
lineedit: case-insensitive matching for '~'
Use case-insensitive matching when determining if the directory name in the prompt can be shortened using '~'. This doesn't seem to have been a problem, as directories are often canonicalized, but it doesn't have any great cost.
-rw-r--r--libbb/lineedit.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 4f68547eb..c06b104ff 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -2151,7 +2151,11 @@ static void parse_and_put_prompt(const char *prmt_ptr)
2151 char *after_home_user; 2151 char *after_home_user;
2152 2152
2153 /* /home/user[/something] -> ~[/something] */ 2153 /* /home/user[/something] -> ~[/something] */
2154#if !ENABLE_PLATFORM_MINGW32
2154 after_home_user = is_prefixed_with(cwd_buf, home); 2155 after_home_user = is_prefixed_with(cwd_buf, home);
2156#else
2157 after_home_user = is_prefixed_with_case(cwd_buf, home);
2158#endif
2155 if (after_home_user 2159 if (after_home_user
2156 && (*after_home_user == '/' || *after_home_user == '\0') 2160 && (*after_home_user == '/' || *after_home_user == '\0')
2157 ) { 2161 ) {