diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-06 09:51:50 +0200 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2010-04-20 19:14:30 +0200 |
commit | 6a37ba9eff6456116d933a0bdc7c85802cc33b10 (patch) | |
tree | 6de8243f0e3b25a7c4edc591a6db3f60304e5af9 /win32 | |
parent | 4e87a91f0cb6a350fc4c5ad5fad41dff58b8ce31 (diff) | |
download | busybox-w32-6a37ba9eff6456116d933a0bdc7c85802cc33b10.tar.gz busybox-w32-6a37ba9eff6456116d933a0bdc7c85802cc33b10.tar.bz2 busybox-w32-6a37ba9eff6456116d933a0bdc7c85802cc33b10.zip |
win32: process.c: add next_path_sep()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Diffstat (limited to 'win32')
-rw-r--r-- | win32/process.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/win32/process.c b/win32/process.c index c97474fb9..5049be030 100644 --- a/win32/process.c +++ b/win32/process.c | |||
@@ -9,6 +9,26 @@ int waitpid(pid_t pid, int *status, unsigned options) | |||
9 | return -1; | 9 | return -1; |
10 | } | 10 | } |
11 | 11 | ||
12 | const char * | ||
13 | next_path_sep(const char *path) | ||
14 | { | ||
15 | static const char *from = NULL, *to; | ||
16 | static int has_semicolon; | ||
17 | int len = strlen(path); | ||
18 | |||
19 | if (!from || !(path >= from && path+len <= to)) { | ||
20 | from = path; | ||
21 | to = from+len; | ||
22 | has_semicolon = strchr(path, ';') != NULL; | ||
23 | } | ||
24 | |||
25 | /* Semicolons take precedence, it's Windows PATH */ | ||
26 | if (has_semicolon) | ||
27 | return strchr(path, ';'); | ||
28 | /* PATH=C:, not really a separator */ | ||
29 | return strchr(has_dos_drive_prefix(path) ? path+2 : path, ':'); | ||
30 | } | ||
31 | |||
12 | /* | 32 | /* |
13 | * Splits the PATH into parts. | 33 | * Splits the PATH into parts. |
14 | */ | 34 | */ |