Applied patch from Jim Gleason that makes it so busybox will still work even
authorMark Whitley <markw@lineo.com>
Fri, 15 Jun 2001 16:54:25 +0000 (16:54 -0000)
committerMark Whitley <markw@lineo.com>
Fri, 15 Jun 2001 16:54:25 +0000 (16:54 -0000)
if you rename it.

applets.c
applets/applets.c

index c1575c70d3220919ae6986f9eec3ca323fd6c385..90667e52e50918f62b89eabb8edf4dc3ce88dd21 100644 (file)
--- 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;
 }
 
 
index c1575c70d3220919ae6986f9eec3ca323fd6c385..90667e52e50918f62b89eabb8edf4dc3ce88dd21 100644 (file)
@@ -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;
 }