aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2019-03-23 08:38:21 +0000
committerRon Yorston <rmy@pobox.com>2019-03-23 08:38:21 +0000
commit578e943afcd9c818f969502a94375b1a70548bf9 (patch)
treef202f7ae8d81109e6c87ab4422eb5c6ece3f2ed3 /libbb
parenta8c63f25b3a8d4b8c9e12b8f6db65c61596da602 (diff)
downloadbusybox-w32-578e943afcd9c818f969502a94375b1a70548bf9.tar.gz
busybox-w32-578e943afcd9c818f969502a94375b1a70548bf9.tar.bz2
busybox-w32-578e943afcd9c818f969502a94375b1a70548bf9.zip
win32: share code to find root prefix of path
Move unc_root_len() from ash to mingw32.c and use it in the new function root_len(), which can be used in make_directory(). This reduces changes to upstream code and saves a few bytes.
Diffstat (limited to 'libbb')
-rw-r--r--libbb/make_directory.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/libbb/make_directory.c b/libbb/make_directory.c
index 9af5552d5..e0fd486d8 100644
--- a/libbb/make_directory.c
+++ b/libbb/make_directory.c
@@ -59,29 +59,8 @@ int FAST_FUNC bb_make_directory(char *path, long mode, int flags)
59 59
60 if (flags & FILEUTILS_RECUR) { /* Get the parent */ 60 if (flags & FILEUTILS_RECUR) { /* Get the parent */
61#if ENABLE_PLATFORM_MINGW32 61#if ENABLE_PLATFORM_MINGW32
62 if (s == path && *s && s[1] == ':') { 62 if (s == path)
63 /* skip drive letter */ 63 s += root_len(path);
64 s += 2;
65 }
66 else if (s == path && s[0] == '/' && s[1] == '/' ) {
67 /* skip UNC server and share */
68 int count = 0;
69 s += 2;
70 while (*s) {
71 if (*s == '/') {
72 do {
73 ++s;
74 } while (*s == '/');
75 if (++count == 2) {
76 --s;
77 break;
78 }
79 }
80 else {
81 ++s;
82 }
83 }
84 }
85#endif 64#endif
86 /* Bypass leading non-'/'s and then subsequent '/'s */ 65 /* Bypass leading non-'/'s and then subsequent '/'s */
87 while (*s) { 66 while (*s) {