aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-12-14 15:27:54 +0000
committerRon Yorston <rmy@pobox.com>2018-12-14 17:41:29 +0000
commita236242374daf911a01e998fabb1cc1268b2be7b (patch)
tree5e30a868b8580a645f94003e27bf96d6ebcd0ee1 /miscutils
parent575581082befff0e049ef67fa36bbdd2ca737e29 (diff)
downloadbusybox-w32-a236242374daf911a01e998fabb1cc1268b2be7b.tar.gz
busybox-w32-a236242374daf911a01e998fabb1cc1268b2be7b.tar.bz2
busybox-w32-a236242374daf911a01e998fabb1cc1268b2be7b.zip
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.
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/man.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/miscutils/man.c b/miscutils/man.c
index 567323a88..4ff58a9a0 100644
--- a/miscutils/man.c
+++ b/miscutils/man.c
@@ -199,19 +199,10 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path)
199 if (path) while (*path) { 199 if (path) while (*path) {
200 char *next_path; 200 char *next_path;
201 char **path_element; 201 char **path_element;
202#if ENABLE_PLATFORM_MINGW32 202 next_path = strchr(path, PATH_SEP);
203 char save;
204
205 next_path = (char *)next_path_sep(path);
206#else
207 next_path = strchr(path, ':');
208#endif
209 if (next_path) { 203 if (next_path) {
210 if (next_path == path) /* "::"? */ 204 if (next_path == path) /* "::"? */
211 goto next; 205 goto next;
212#if ENABLE_PLATFORM_MINGW32
213 save = *next_path;
214#endif
215 *next_path = '\0'; 206 *next_path = '\0';
216 } 207 }
217 /* Do we already have path? */ 208 /* Do we already have path? */
@@ -230,11 +221,7 @@ static char **add_MANPATH(char **man_path_list, int *count_mp, char *path)
230 if (!next_path) 221 if (!next_path)
231 break; 222 break;
232 /* "path" may be a result of getenv(), be nice and don't mangle it */ 223 /* "path" may be a result of getenv(), be nice and don't mangle it */
233#if ENABLE_PLATFORM_MINGW32 224 *next_path = PATH_SEP;
234 *next_path = save;
235#else
236 *next_path = ':';
237#endif
238 next: 225 next:
239 path = next_path + 1; 226 path = next_path + 1;
240 } 227 }