summaryrefslogtreecommitdiff
path: root/applets/applets.c
diff options
context:
space:
mode:
Diffstat (limited to 'applets/applets.c')
-rw-r--r--applets/applets.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/applets/applets.c b/applets/applets.c
index f8abb27..ebd1ff3 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -44,7 +44,7 @@ static const char usage_messages[] =
static struct BB_applet *applet_using;
/* The -1 arises because of the {0,NULL,0,-1} entry above. */
-const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
+const unsigned short NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1);
#ifdef CONFIG_FEATURE_SUID_CONFIG
@@ -459,8 +459,6 @@ static int applet_name_compare(const void *name, const void *vapplet)
return strcmp(name, applet->name);
}
-extern const size_t NUM_APPLETS;
-
struct BB_applet *find_applet_by_name(const char *name)
{
return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet),
@@ -469,15 +467,19 @@ struct BB_applet *find_applet_by_name(const char *name)
void run_applet_by_name(const char *name, int argc, char **argv)
{
- if (ENABLE_FEATURE_SUID_CONFIG) parse_config_file();
+ if (ENABLE_FEATURE_SUID_CONFIG)
+ parse_config_file();
- if (!strncmp(name, "busybox", 7)) busybox_main(argc, argv);
+ if (!strncmp(name, "busybox", 7))
+ exit(busybox_main(argc, argv));
/* Do a binary search to find the applet entry given the name. */
applet_using = find_applet_by_name(name);
if (applet_using) {
applet_name = applet_using->name;
- if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage();
- if(ENABLE_FEATURE_SUID) check_suid(applet_using);
- exit((*(applet_using->main))(argc, argv));
+ if (argc == 2 && !strcmp(argv[1], "--help"))
+ bb_show_usage();
+ if (ENABLE_FEATURE_SUID)
+ check_suid(applet_using);
+ exit(applet_using->main(argc, argv));
}
}