aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2015-06-01 15:22:42 +0100
committerRon Yorston <rmy@pobox.com>2015-06-01 15:22:42 +0100
commit7bf5f10016ef3d99d4a6a45b6a300d04d930de2a (patch)
treec027805369d9ceaef80e47731353b914228d89ea /libbb/appletlib.c
parent0f08b401f107732d6c88486a739f26ce04578c34 (diff)
downloadbusybox-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.
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r--libbb/appletlib.c4
1 files changed, 4 insertions, 0 deletions
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);