diff options
author | Ron Yorston <rmy@pobox.com> | 2020-08-28 11:08:24 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-08-28 11:08:24 +0100 |
commit | adf41838bb4d33efc8069f9590f8e7ccc3978295 (patch) | |
tree | d2763525a85bc220a5cfce6491710d67521e1926 | |
parent | 5f696450596f34c80edb1bf866a876fcc8692334 (diff) | |
download | busybox-w32-adf41838bb4d33efc8069f9590f8e7ccc3978295.tar.gz busybox-w32-adf41838bb4d33efc8069f9590f8e7ccc3978295.tar.bz2 busybox-w32-adf41838bb4d33efc8069f9590f8e7ccc3978295.zip |
ash, ls: improve support for 'c:path'
Revert commit 249f68e3c (win32: append '/' to bare drive name in
opendir).
Instead add better handling for paths of the form 'c:path' to ls
and expmeta() in ash.
Adds 64 bytes.
-rw-r--r-- | coreutils/ls.c | 5 | ||||
-rw-r--r-- | include/mingw.h | 6 | ||||
-rw-r--r-- | shell/ash.c | 4 | ||||
-rw-r--r-- | win32/mingw.c | 15 |
4 files changed, 9 insertions, 21 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c index ad754c14d..2f9338f19 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -957,6 +957,11 @@ static struct dnode **scan_one_dir(const char *path, unsigned *nfiles_p) | |||
957 | continue; /* if only -A, skip . and .. but show other dotfiles */ | 957 | continue; /* if only -A, skip . and .. but show other dotfiles */ |
958 | } | 958 | } |
959 | } | 959 | } |
960 | #if ENABLE_PLATFORM_MINGW32 | ||
961 | if (has_dos_drive_prefix(path) && path[2] == '\0') | ||
962 | fullname = xasprintf("%s%s", path, entry->d_name); | ||
963 | else | ||
964 | #endif | ||
960 | fullname = concat_path_file(path, entry->d_name); | 965 | fullname = concat_path_file(path, entry->d_name); |
961 | cur = my_stat(fullname, bb_basename(fullname), 0); | 966 | cur = my_stat(fullname, bb_basename(fullname), 0); |
962 | #if !ENABLE_PLATFORM_MINGW32 | 967 | #if !ENABLE_PLATFORM_MINGW32 |
diff --git a/include/mingw.h b/include/mingw.h index 79cf6c783..d70bc26e6 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -472,12 +472,6 @@ int mingw_isatty(int fd); | |||
472 | int utimes(const char *file_name, const struct timeval times[2]); | 472 | int utimes(const char *file_name, const struct timeval times[2]); |
473 | 473 | ||
474 | /* | 474 | /* |
475 | * dirent.h | ||
476 | */ | ||
477 | DIR *mingw_opendir(const char *path); | ||
478 | #define opendir mingw_opendir | ||
479 | |||
480 | /* | ||
481 | * Functions with different prototypes in BusyBox and WIN32 | 475 | * Functions with different prototypes in BusyBox and WIN32 |
482 | */ | 476 | */ |
483 | #define itoa bb_itoa | 477 | #define itoa bb_itoa |
diff --git a/shell/ash.c b/shell/ash.c index 1d7d916da..1f57c2d7e 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -8293,6 +8293,10 @@ expmeta(exp_t *exp, char *name, unsigned name_len, unsigned expdir_len) | |||
8293 | 8293 | ||
8294 | metaflag = 0; | 8294 | metaflag = 0; |
8295 | start = name; | 8295 | start = name; |
8296 | #if ENABLE_PLATFORM_MINGW32 | ||
8297 | if (expdir_len == 0 && has_dos_drive_prefix(start) && start[2] != '/') | ||
8298 | start += 2; | ||
8299 | #endif | ||
8296 | for (p = name; esc = 0, *p; p += esc + 1) { | 8300 | for (p = name; esc = 0, *p; p += esc + 1) { |
8297 | if (*p == '*' || *p == '?') | 8301 | if (*p == '*' || *p == '?') |
8298 | metaflag = 1; | 8302 | metaflag = 1; |
diff --git a/win32/mingw.c b/win32/mingw.c index 051dc3c0d..16e103b54 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1528,21 +1528,6 @@ size_t FAST_FUNC remove_cr(char *p, size_t len) | |||
1528 | return j; | 1528 | return j; |
1529 | } | 1529 | } |
1530 | 1530 | ||
1531 | #undef opendir | ||
1532 | DIR *mingw_opendir(const char *path) | ||
1533 | { | ||
1534 | char name[4]; | ||
1535 | |||
1536 | if (isalpha(path[0]) && path[1] == ':' && path[2] == '\0') { | ||
1537 | strcpy(name, path); | ||
1538 | name[2] = '/'; | ||
1539 | name[3] = '\0'; | ||
1540 | path = name; | ||
1541 | } | ||
1542 | |||
1543 | return opendir(path); | ||
1544 | } | ||
1545 | |||
1546 | off_t mingw_lseek(int fd, off_t offset, int whence) | 1531 | off_t mingw_lseek(int fd, off_t offset, int whence) |
1547 | { | 1532 | { |
1548 | HANDLE h = (HANDLE)_get_osfhandle(fd); | 1533 | HANDLE h = (HANDLE)_get_osfhandle(fd); |