aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mingw.h1
-rw-r--r--shell/ash.c1
-rw-r--r--win32/mingw.c13
3 files changed, 15 insertions, 0 deletions
diff --git a/include/mingw.h b/include/mingw.h
index 5a3c75ff6..c41c0f91e 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -631,6 +631,7 @@ MINGW_BB_WCHAR_T *bs_to_slash_u(MINGW_BB_WCHAR_T *p) FAST_FUNC;
631 631
632char *bs_to_slash(char *p) FAST_FUNC; 632char *bs_to_slash(char *p) FAST_FUNC;
633void slash_to_bs(char *p) FAST_FUNC; 633void slash_to_bs(char *p) FAST_FUNC;
634void strip_dot_space(char *p) FAST_FUNC;
634size_t remove_cr(char *p, size_t len) FAST_FUNC; 635size_t remove_cr(char *p, size_t len) FAST_FUNC;
635 636
636int err_win_to_posix(void); 637int err_win_to_posix(void);
diff --git a/shell/ash.c b/shell/ash.c
index 1fc2a44b1..3919118f0 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -3338,6 +3338,7 @@ updatepwd(const char *dir)
3338 if (new > lim) 3338 if (new > lim)
3339 STUNPUTC(new); 3339 STUNPUTC(new);
3340 *new = 0; 3340 *new = 0;
3341 strip_dot_space((char *)stackblock());
3341 fix_path_case((char *)stackblock()); 3342 fix_path_case((char *)stackblock());
3342 return bs_to_slash((char *)stackblock()); 3343 return bs_to_slash((char *)stackblock());
3343#else 3344#else
diff --git a/win32/mingw.c b/win32/mingw.c
index 87e7ca602..6842dba48 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -2178,6 +2178,19 @@ void FAST_FUNC slash_to_bs(char *p)
2178 } 2178 }
2179} 2179}
2180 2180
2181/* Windows strips trailing dots and spaces from the last component of
2182 * a file path. This routine emulates that behaviour so we can preempt
2183 * Windows if necessary. */
2184void FAST_FUNC strip_dot_space(char *p)
2185{
2186 char *start = (char *)bb_basename(p);
2187 char *end = start + strlen(start);
2188
2189 while (end > start && (end[-1] == '.' || end[-1] == ' ')) {
2190 *--end = '\0';
2191 }
2192}
2193
2181size_t FAST_FUNC remove_cr(char *p, size_t len) 2194size_t FAST_FUNC remove_cr(char *p, size_t len)
2182{ 2195{
2183 ssize_t i, j; 2196 ssize_t i, j;