summaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko2007-11-29 03:31:20 +0000
committerDenis Vlasenko2007-11-29 03:31:20 +0000
commit745cd17926a9d75cdd6482d5ce58227b492d1ebe (patch)
tree568f3236704000eed61d3460f9eef92e9535b746 /libbb
parentc253778de92441b61806e1e4e7806e91f17ea50f (diff)
downloadbusybox-745cd17926a9d75cdd6482d5ce58227b492d1ebe.zip
busybox-745cd17926a9d75cdd6482d5ce58227b492d1ebe.tar.gz
Further optimize applet tables; prettify build output
text data bss dec hex filename 775923 929 9100 785952 bfe20 busybox_old 775565 929 9100 785594 bfcba busybox_unstripped
Diffstat (limited to 'libbb')
-rw-r--r--libbb/appletlib.c14
-rw-r--r--libbb/vfork_daemon_rexec.c2
2 files changed, 8 insertions, 8 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index dcf24f5..d5a2d06 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -101,19 +101,17 @@ void bb_show_usage(void)
}
+/* NB: any char pointer will work as well, not necessarily applet_names */
static int applet_name_compare(const void *name, const void *v)
{
int i = (const char *)v - applet_names;
return strcmp(name, APPLET_NAME(i));
}
-
int find_applet_by_name(const char *name)
{
- const char *p;
/* Do a binary search to find the applet entry given the name. */
-
- /* NB: any char pointer will work as well, not necessarily applet_names */
- p = bsearch(name, applet_names, ARRAY_SIZE(applet_mains), 1, applet_name_compare);
+ const char *p;
+ p = bsearch(name, applet_names, ARRAY_SIZE(applet_main), 1, applet_name_compare);
if (!p)
return -1;
return p - applet_names;
@@ -543,10 +541,12 @@ static void install_links(const char *busybox, int use_symbolic_links)
if (use_symbolic_links)
lf = symlink;
- for (i = 0; i < ARRAY_SIZE(applet_mains); i++) {
+ for (i = 0; i < ARRAY_SIZE(applet_main); i++) {
fpc = concat_path_file(
install_dir[APPLET_INSTALL_LOC(i)],
APPLET_NAME(i));
+ // debug: bb_error_msg("%slinking %s to busybox",
+ // use_symbolic_links ? "sym" : "", fpc);
rc = lf(busybox, fpc);
if (rc != 0 && errno != EEXIST) {
bb_simple_perror_msg(fpc);
@@ -644,7 +644,7 @@ void run_applet_no_and_exit(int applet_no, char **argv)
bb_show_usage();
if (ENABLE_FEATURE_SUID)
check_suid(applet_no);
- exit(applet_mains[applet_no](argc, argv));
+ exit(applet_main[applet_no](argc, argv));
}
void run_applet_and_exit(const char *name, char **argv)
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index 1d6817e..d6e233a 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -143,7 +143,7 @@ int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **
char *tmp_argv[argc+1];
memcpy(tmp_argv, argv, (argc+1) * sizeof(tmp_argv[0]));
/* Finally we can call NOFORK applet's main() */
- rc = applet_mains[applet_no](argc, tmp_argv);
+ rc = applet_main[applet_no](argc, tmp_argv);
} else { /* xfunc died in NOFORK applet */
/* in case they meant to return 0... */
if (rc == -2222)