diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-28 12:52:44 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-28 13:09:50 +0000 |
commit | 548ec7045bc7c80eaf03e92f390d1da2c9e9cd86 (patch) | |
tree | b4c0102539c8889eeeec9eef8afa863510c7592b /miscutils | |
parent | 215e01e70f13f28d1a4dbe297f095b25de04ee21 (diff) | |
download | busybox-w32-548ec7045bc7c80eaf03e92f390d1da2c9e9cd86.tar.gz busybox-w32-548ec7045bc7c80eaf03e92f390d1da2c9e9cd86.tar.bz2 busybox-w32-548ec7045bc7c80eaf03e92f390d1da2c9e9cd86.zip |
win32: interpret absolute paths as relative to %SYSTEMDRIVE%
BusyBox contains hardcoded references to absolute paths which
are unique in the *nix world but on Microsoft Windows are
interpreted as being on the current drive. To make these unique
again consider them to be relative to %SYSTEMDRIVE%.
Support this by adding functions to:
- determine the system drive (not using the environment variable);
- change a process's current directory to the root of the system drive;
- make relative paths absolute before changing directory (if needed).
The following applications have been modified:
- ash references /etc/profile from the system drive;
- dpkg places its data store on and installs files to the system drive;
- rpm installs files to the system drive;
- man looks for configuration files and man pages on the system drive.
See GitHub issue #158.
Diffstat (limited to 'miscutils')
-rw-r--r-- | miscutils/man.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/miscutils/man.c b/miscutils/man.c index 3c1a79085..0bc11e623 100644 --- a/miscutils/man.c +++ b/miscutils/man.c | |||
@@ -253,11 +253,22 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
253 | int cur_mp; | 253 | int cur_mp; |
254 | int opt, not_found; | 254 | int opt, not_found; |
255 | char *token[2]; | 255 | char *token[2]; |
256 | #if ENABLE_PLATFORM_MINGW32 | ||
257 | char **ptr; | ||
258 | #endif | ||
256 | 259 | ||
257 | INIT_G(); | 260 | INIT_G(); |
258 | 261 | ||
259 | opt = getopt32(argv, "^+" "aw" "\0" "-1"/*at least one arg*/); | 262 | opt = getopt32(argv, "^+" "aw" "\0" "-1"/*at least one arg*/); |
260 | argv += optind; | 263 | argv += optind; |
264 | #if ENABLE_PLATFORM_MINGW32 | ||
265 | /* add system drive prefix to filenames, if necessary */ | ||
266 | for (ptr = argv; *ptr; ++ptr) { | ||
267 | if (strchr(*ptr, '/') || strchr(*ptr, '\\')) | ||
268 | *ptr = xabsolute_path(*ptr); | ||
269 | } | ||
270 | chdir_system_drive(); | ||
271 | #endif | ||
261 | 272 | ||
262 | sec_list = xstrdup("0p:1:1p:2:3:3p:4:5:6:7:8:9"); | 273 | sec_list = xstrdup("0p:1:1p:2:3:3p:4:5:6:7:8:9"); |
263 | 274 | ||
@@ -311,7 +322,8 @@ int man_main(int argc UNUSED_PARAM, char **argv) | |||
311 | char *relpath = concat_path_file(dirname(exepath), "man"); | 322 | char *relpath = concat_path_file(dirname(exepath), "man"); |
312 | if (count_mp == 0) { | 323 | if (count_mp == 0) { |
313 | /* default must match path set above */ | 324 | /* default must match path set above */ |
314 | man_path_list = add_MANPATH(man_path_list, &count_mp, "/usr/man"); | 325 | man_path_list = add_MANPATH(man_path_list, &count_mp, |
326 | (char *)"/usr/man"); | ||
315 | } | 327 | } |
316 | man_path_list = add_MANPATH(man_path_list, &count_mp, relpath); | 328 | man_path_list = add_MANPATH(man_path_list, &count_mp, relpath); |
317 | free(relpath); | 329 | free(relpath); |