summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Whitley2001-06-15 16:54:25 +0000
committerMark Whitley2001-06-15 16:54:25 +0000
commitbd4b621e910ea096fa8b7db19012eded43eb0006 (patch)
tree0b639585e4bf9fb16d483a81b0588e62716ed9a9
parent6bad1fa1fdfe330de2bb7eed18ed3bb1bb875e57 (diff)
downloadbusybox-bd4b621e910ea096fa8b7db19012eded43eb0006.zip
busybox-bd4b621e910ea096fa8b7db19012eded43eb0006.tar.gz
Applied patch from Jim Gleason that makes it so busybox will still work even
if you rename it.
-rw-r--r--applets.c11
-rw-r--r--applets/applets.c11
2 files changed, 20 insertions, 2 deletions
diff --git a/applets.c b/applets.c
index c1575c7..90667e5 100644
--- a/applets.c
+++ b/applets.c
@@ -84,13 +84,22 @@ struct BB_applet *find_applet_by_name(const char *name)
void run_applet_by_name(const char *name, int argc, char **argv)
{
+ static int recurse_level = 0;
+
+ recurse_level++;
/* Do a binary search to find the applet entry given the name. */
if ((applet_using = find_applet_by_name(name)) != NULL) {
applet_name = applet_using->name;
- if (argv[1] && strcmp(argv[1], "--help") == 0)
+ if (argv[1] && strcmp(argv[1], "--help") == 0) {
show_usage();
+ }
exit((*(applet_using->main)) (argc, argv));
}
+ /* Just in case they have renamed busybox - Check argv[1] */
+ if (recurse_level == 1) {
+ run_applet_by_name("busybox", argc, argv);
+ }
+ recurse_level = 0;
}
diff --git a/applets/applets.c b/applets/applets.c
index c1575c7..90667e5 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -84,13 +84,22 @@ struct BB_applet *find_applet_by_name(const char *name)
void run_applet_by_name(const char *name, int argc, char **argv)
{
+ static int recurse_level = 0;
+
+ recurse_level++;
/* Do a binary search to find the applet entry given the name. */
if ((applet_using = find_applet_by_name(name)) != NULL) {
applet_name = applet_using->name;
- if (argv[1] && strcmp(argv[1], "--help") == 0)
+ if (argv[1] && strcmp(argv[1], "--help") == 0) {
show_usage();
+ }
exit((*(applet_using->main)) (argc, argv));
}
+ /* Just in case they have renamed busybox - Check argv[1] */
+ if (recurse_level == 1) {
+ run_applet_by_name("busybox", argc, argv);
+ }
+ recurse_level = 0;
}