mirror of https://github.com/mirror/busybox.git
if only one applet is enabled, make "busybox applet [params]" work as expected
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>1_19_stable
parent
714e2b7e6a
commit
8f0af3b001
|
@ -598,7 +598,6 @@ static const char *const install_dir[] = {
|
|||
# endif
|
||||
};
|
||||
|
||||
|
||||
/* create (sym)links for each applet */
|
||||
static void install_links(const char *busybox, int use_symbolic_links,
|
||||
char *custom_install_dir)
|
||||
|
@ -771,7 +770,7 @@ void FAST_FUNC run_applet_and_exit(const char *name, char **argv)
|
|||
int applet = find_applet_by_name(name);
|
||||
if (applet >= 0)
|
||||
run_applet_no_and_exit(applet, argv);
|
||||
if (!strncmp(name, "busybox", 7))
|
||||
if (strncmp(name, "busybox", 7) == 0)
|
||||
exit(busybox_main(argv));
|
||||
}
|
||||
|
||||
|
@ -803,14 +802,6 @@ int main(int argc UNUSED_PARAM, char **argv)
|
|||
mallopt(M_MMAP_THRESHOLD, 8 * PAGE_SIZE - 256);
|
||||
#endif
|
||||
|
||||
#if defined(SINGLE_APPLET_MAIN)
|
||||
/* Only one applet is selected by the user! */
|
||||
/* applet_names in this case is just "applet\0\0" */
|
||||
lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv));
|
||||
return SINGLE_APPLET_MAIN(argc, argv);
|
||||
#else
|
||||
lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
|
||||
|
||||
#if !BB_MMU
|
||||
/* NOMMU re-exec trick sets high-order bit in first byte of name */
|
||||
if (argv[0][0] & 0x80) {
|
||||
|
@ -818,6 +809,19 @@ int main(int argc UNUSED_PARAM, char **argv)
|
|||
argv[0][0] &= 0x7f;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SINGLE_APPLET_MAIN)
|
||||
/* Only one applet is selected in .config */
|
||||
if (strncmp(argv[0], "busybox", 7) == 0) {
|
||||
/* "busybox <applet> <params>" should still work as expected */
|
||||
argv++;
|
||||
}
|
||||
/* applet_names in this case is just "applet\0\0" */
|
||||
lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv));
|
||||
return SINGLE_APPLET_MAIN(argc, argv);
|
||||
#else
|
||||
lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
|
||||
|
||||
applet_name = argv[0];
|
||||
if (applet_name[0] == '-')
|
||||
applet_name++;
|
||||
|
|
Loading…
Reference in New Issue