From a236242374daf911a01e998fabb1cc1268b2be7b Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 14 Dec 2018 15:27:54 +0000 Subject: win32: special treatment for PATH The PATH shell variable is a special case. It can be exported to the environment where it might be interpreted by native applications which assume the separator is ';'. Hence: - require that the separator used in PATH is ';' - enforce this by intercepting calls to setvareq() that set PATH and adjusting its value if necessary. As a result of this the code to parse PATH can be simplified by replacing the hardcoded Unix ':' path separator by the platform- dependent macro PATH_SEP. The MANPATH variable is also required to use ';' as its separator but since it's less likely to be used this isn't enforced. --- win32/process.c | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'win32') diff --git a/win32/process.c b/win32/process.c index 60fea01ad..37496db7b 100644 --- a/win32/process.c +++ b/win32/process.c @@ -24,26 +24,6 @@ int waitpid(pid_t pid, int *status, int options) return -1; } -const char * -next_path_sep(const char *path) -{ - static const char *from = NULL, *to; - static int has_semicolon; - int len = strlen(path); - - if (!from || !(path >= from && path+len <= to)) { - from = path; - to = from+len; - has_semicolon = strchr(path, ';') != NULL; - } - - /* Semicolons take precedence, it's Windows PATH */ - if (has_semicolon) - return strchr(path, ';'); - /* PATH=C:, not really a separator */ - return strchr(has_dos_drive_prefix(path) ? path+2 : path, ':'); -} - typedef struct { char *path; char *name; -- cgit v1.2.3-55-g6feb