From 7bf5f10016ef3d99d4a6a45b6a300d04d930de2a Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Mon, 1 Jun 2015 15:22:42 +0100 Subject: 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. --- libbb/appletlib.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libbb') 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) applet_name = applet_name_env; unsetenv("BUSYBOX_APPLET_NAME"); } + else if ( argv[1] && argv[2] && strcmp(argv[1], "--busybox") == 0 ) { + argv += 2; + applet_name = argv[0]; + } else { char *s = argv[0]; int i, len = strlen(s); -- cgit v1.2.3-55-g6feb