diff options
author | Ron Yorston <rmy@pobox.com> | 2015-06-01 15:22:42 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-06-01 15:22:42 +0100 |
commit | 7bf5f10016ef3d99d4a6a45b6a300d04d930de2a (patch) | |
tree | c027805369d9ceaef80e47731353b914228d89ea | |
parent | 0f08b401f107732d6c88486a739f26ce04578c34 (diff) | |
download | busybox-w32-7bf5f10016ef3d99d4a6a45b6a300d04d930de2a.tar.gz busybox-w32-7bf5f10016ef3d99d4a6a45b6a300d04d930de2a.tar.bz2 busybox-w32-7bf5f10016ef3d99d4a6a45b6a300d04d930de2a.zip |
mingw: add magic '--busybox' flag
If BusyBox is invoked with argv[1] set to --busybox skip the first
two arguments so that argv[2] becomes the applet name and argv[3]
et seq are its arguments.
This is needed when BusyBox is run as sh.exe and the executable is
reexecuted to invoke compress/decompress applets.
-rw-r--r-- | archival/libarchive/open_transformer.c | 3 | ||||
-rw-r--r-- | archival/tar.c | 2 | ||||
-rw-r--r-- | libbb/appletlib.c | 4 |
3 files changed, 7 insertions, 2 deletions
diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c index 24524f6ee..c7ec4a74d 100644 --- a/archival/libarchive/open_transformer.c +++ b/archival/libarchive/open_transformer.c | |||
@@ -163,7 +163,8 @@ void FAST_FUNC fork_transformer(int fd, const char *transform_prog) | |||
163 | int fd1; | 163 | int fd1; |
164 | 164 | ||
165 | if (find_applet_by_name(transform_prog) >= 0) { | 165 | if (find_applet_by_name(transform_prog) >= 0) { |
166 | cmd = xasprintf("%s %s -cf -", bb_busybox_exec_path, transform_prog); | 166 | cmd = xasprintf("%s --busybox %s -cf -", bb_busybox_exec_path, |
167 | transform_prog); | ||
167 | } | 168 | } |
168 | else { | 169 | else { |
169 | cmd = xasprintf("%s -cf -", transform_prog); | 170 | cmd = xasprintf("%s -cf -", transform_prog); |
diff --git a/archival/tar.c b/archival/tar.c index 1f9dd23d2..d1b0e475d 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -685,7 +685,7 @@ static pid_t vfork_compressor(int tar_fd, const char *gzip) | |||
685 | pid_t pid; | 685 | pid_t pid; |
686 | 686 | ||
687 | if (find_applet_by_name(gzip) >= 0) { | 687 | if (find_applet_by_name(gzip) >= 0) { |
688 | cmd = xasprintf("%s %s -cf -", bb_busybox_exec_path, gzip); | 688 | cmd = xasprintf("%s --busybox %s -cf -", bb_busybox_exec_path, gzip); |
689 | } | 689 | } |
690 | else { | 690 | else { |
691 | cmd = xasprintf("%s -cf -", gzip); | 691 | cmd = xasprintf("%s -cf -", gzip); |
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 841494a70..e99d3a5c4 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -864,6 +864,10 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
864 | applet_name = applet_name_env; | 864 | applet_name = applet_name_env; |
865 | unsetenv("BUSYBOX_APPLET_NAME"); | 865 | unsetenv("BUSYBOX_APPLET_NAME"); |
866 | } | 866 | } |
867 | else if ( argv[1] && argv[2] && strcmp(argv[1], "--busybox") == 0 ) { | ||
868 | argv += 2; | ||
869 | applet_name = argv[0]; | ||
870 | } | ||
867 | else { | 871 | else { |
868 | char *s = argv[0]; | 872 | char *s = argv[0]; |
869 | int i, len = strlen(s); | 873 | int i, len = strlen(s); |