diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-24 15:23:28 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-24 15:23:28 +0000 |
commit | 0ee3999d13b662d233dfc7decdd4d691cd66fdda (patch) | |
tree | 283bf4908f787f50a90cb84c014a580485307a9b /applets/applets.c | |
parent | 7cea262273659e9894d446a3f9ea6b83fb18892a (diff) | |
download | busybox-w32-0ee3999d13b662d233dfc7decdd4d691cd66fdda.tar.gz busybox-w32-0ee3999d13b662d233dfc7decdd4d691cd66fdda.tar.bz2 busybox-w32-0ee3999d13b662d233dfc7decdd4d691cd66fdda.zip |
random tiny size savings
Diffstat (limited to 'applets/applets.c')
-rw-r--r-- | applets/applets.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/applets/applets.c b/applets/applets.c index f8abb2767..ebd1ff313 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -44,7 +44,7 @@ static const char usage_messages[] = | |||
44 | static struct BB_applet *applet_using; | 44 | static struct BB_applet *applet_using; |
45 | 45 | ||
46 | /* The -1 arises because of the {0,NULL,0,-1} entry above. */ | 46 | /* The -1 arises because of the {0,NULL,0,-1} entry above. */ |
47 | const size_t NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); | 47 | const unsigned short NUM_APPLETS = (sizeof (applets) / sizeof (struct BB_applet) - 1); |
48 | 48 | ||
49 | 49 | ||
50 | #ifdef CONFIG_FEATURE_SUID_CONFIG | 50 | #ifdef CONFIG_FEATURE_SUID_CONFIG |
@@ -459,8 +459,6 @@ static int applet_name_compare(const void *name, const void *vapplet) | |||
459 | return strcmp(name, applet->name); | 459 | return strcmp(name, applet->name); |
460 | } | 460 | } |
461 | 461 | ||
462 | extern const size_t NUM_APPLETS; | ||
463 | |||
464 | struct BB_applet *find_applet_by_name(const char *name) | 462 | struct BB_applet *find_applet_by_name(const char *name) |
465 | { | 463 | { |
466 | return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet), | 464 | return bsearch(name, applets, NUM_APPLETS, sizeof(struct BB_applet), |
@@ -469,15 +467,19 @@ struct BB_applet *find_applet_by_name(const char *name) | |||
469 | 467 | ||
470 | void run_applet_by_name(const char *name, int argc, char **argv) | 468 | void run_applet_by_name(const char *name, int argc, char **argv) |
471 | { | 469 | { |
472 | if (ENABLE_FEATURE_SUID_CONFIG) parse_config_file(); | 470 | if (ENABLE_FEATURE_SUID_CONFIG) |
471 | parse_config_file(); | ||
473 | 472 | ||
474 | if (!strncmp(name, "busybox", 7)) busybox_main(argc, argv); | 473 | if (!strncmp(name, "busybox", 7)) |
474 | exit(busybox_main(argc, argv)); | ||
475 | /* Do a binary search to find the applet entry given the name. */ | 475 | /* Do a binary search to find the applet entry given the name. */ |
476 | applet_using = find_applet_by_name(name); | 476 | applet_using = find_applet_by_name(name); |
477 | if (applet_using) { | 477 | if (applet_using) { |
478 | applet_name = applet_using->name; | 478 | applet_name = applet_using->name; |
479 | if(argc==2 && !strcmp(argv[1], "--help")) bb_show_usage(); | 479 | if (argc == 2 && !strcmp(argv[1], "--help")) |
480 | if(ENABLE_FEATURE_SUID) check_suid(applet_using); | 480 | bb_show_usage(); |
481 | exit((*(applet_using->main))(argc, argv)); | 481 | if (ENABLE_FEATURE_SUID) |
482 | check_suid(applet_using); | ||
483 | exit(applet_using->main(argc, argv)); | ||
482 | } | 484 | } |
483 | } | 485 | } |