diff options
author | Ron Yorston <rmy@pobox.com> | 2021-03-01 09:20:58 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-03-01 09:20:58 +0000 |
commit | b2ea5c74c8e2a26f9d9e8978d41a2368693e5ff7 (patch) | |
tree | 93bafe054a07f805ec2d0d17f930328001710c56 | |
parent | aa1512610a7d5081f0b721e7dc24a95527c07a95 (diff) | |
download | busybox-w32-b2ea5c74c8e2a26f9d9e8978d41a2368693e5ff7.tar.gz busybox-w32-b2ea5c74c8e2a26f9d9e8978d41a2368693e5ff7.tar.bz2 busybox-w32-b2ea5c74c8e2a26f9d9e8978d41a2368693e5ff7.zip |
win32: move is_absolute_path()
Make is_absolute_path() a function rather than a macro and move it
from ash.c into mingw.c.
-rw-r--r-- | include/mingw.h | 1 | ||||
-rw-r--r-- | shell/ash.c | 3 | ||||
-rw-r--r-- | win32/mingw.c | 9 |
3 files changed, 10 insertions, 3 deletions
diff --git a/include/mingw.h b/include/mingw.h index 5cb5cb88c..d48237add 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -561,3 +561,4 @@ void make_sparse(int fd, off_t start, off_t end); | |||
561 | int skip_ansi_emulation(int reset); | 561 | int skip_ansi_emulation(int reset); |
562 | int unix_path(const char *path); | 562 | int unix_path(const char *path); |
563 | int has_path(const char *file); | 563 | int has_path(const char *file); |
564 | int is_absolute_path(const char *path); | ||
diff --git a/shell/ash.c b/shell/ash.c index 5c6eb5759..2c99c3ead 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -322,8 +322,6 @@ typedef long arith_t; | |||
322 | 322 | ||
323 | #if !ENABLE_PLATFORM_MINGW32 | 323 | #if !ENABLE_PLATFORM_MINGW32 |
324 | # define is_absolute_path(path) ((path)[0] == '/') | 324 | # define is_absolute_path(path) ((path)[0] == '/') |
325 | #else | ||
326 | # define is_absolute_path(path) ((path)[0] == '/' || (path)[0] == '\\' || has_dos_drive_prefix(path)) | ||
327 | #endif | 325 | #endif |
328 | 326 | ||
329 | #if !BB_MMU | 327 | #if !BB_MMU |
@@ -3028,7 +3026,6 @@ updatepwd(const char *dir) | |||
3028 | { | 3026 | { |
3029 | #if ENABLE_PLATFORM_MINGW32 | 3027 | #if ENABLE_PLATFORM_MINGW32 |
3030 | # define is_path_sep(x) ((x) == '/' || (x) == '\\') | 3028 | # define is_path_sep(x) ((x) == '/' || (x) == '\\') |
3031 | # define is_root(x) (is_path_sep(x[0]) && x[1] == '\0') | ||
3032 | /* | 3029 | /* |
3033 | * Due to Windows drive notion, getting pwd is a completely | 3030 | * Due to Windows drive notion, getting pwd is a completely |
3034 | * different thing. Handle it in a separate routine | 3031 | * different thing. Handle it in a separate routine |
diff --git a/win32/mingw.c b/win32/mingw.c index 6e1dc6a9a..c9b72ae98 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -1922,3 +1922,12 @@ int has_path(const char *file) | |||
1922 | return strchr(file, '/') || strchr(file, '\\') || | 1922 | return strchr(file, '/') || strchr(file, '\\') || |
1923 | has_dos_drive_prefix(file); | 1923 | has_dos_drive_prefix(file); |
1924 | } | 1924 | } |
1925 | |||
1926 | /* This function is misnamed. It's actually a test for 'is not a path | ||
1927 | * relative to the current working directory'. On Unix this is the | ||
1928 | * same as 'is an absolute path' but Windows also has paths relative to | ||
1929 | * current root and relative to current directory of another drive. */ | ||
1930 | int is_absolute_path(const char *path) | ||
1931 | { | ||
1932 | return path[0] == '/' || path[0] == '\\' || has_dos_drive_prefix(path); | ||
1933 | } | ||