summaryrefslogtreecommitdiff
path: root/applets/applets.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-12-24 15:23:28 +0000
committerDenis Vlasenko2006-12-24 15:23:28 +0000
commit0ee3999d13b662d233dfc7decdd4d691cd66fdda (patch)
tree283bf4908f787f50a90cb84c014a580485307a9b /applets/applets.c
parent7cea262273659e9894d446a3f9ea6b83fb18892a (diff)
downloadbusybox-0ee3999d13b662d233dfc7decdd4d691cd66fdda.zip
busybox-0ee3999d13b662d233dfc7decdd4d691cd66fdda.tar.gz
random tiny size savings
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));
}
}