aboutsummaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-10 18:00:36 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2010-09-10 19:28:22 +1000
commitc9158195f6bf0a73bdd5d057d8db7f182397f17c (patch)
tree45553390d4b6e94636473354165397b01b20a393 /win32
parent5161fa8edd5a84f5b02898f13f343254c68eca23 (diff)
downloadbusybox-w32-c9158195f6bf0a73bdd5d057d8db7f182397f17c.tar.gz
busybox-w32-c9158195f6bf0a73bdd5d057d8db7f182397f17c.tar.bz2
busybox-w32-c9158195f6bf0a73bdd5d057d8db7f182397f17c.zip
win32: add next_path_sep()
Diffstat (limited to 'win32')
-rw-r--r--win32/process.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/win32/process.c b/win32/process.c
index 55f5fef14..0936e1c42 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
12const char *
13next_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
12static const char * 32static const char *
13parse_interpreter(const char *cmd) 33parse_interpreter(const char *cmd)
14{ 34{