aboutsummaryrefslogtreecommitdiff
path: root/applets/applet_tables.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-08 21:13:28 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-08 21:13:28 +0000
commit79cedcb2c0d88531323e5c2a31fd8465241fbffa (patch)
treed4a8ab06d87bb96cf8d5c003b464f8e1dfb53fbb /applets/applet_tables.c
parent643dcf00e32bb131b8a8b77ef570289ed27dae57 (diff)
downloadbusybox-79cedcb2c0d88531323e5c2a31fd8465241fbffa.tar.gz
Avoid linking in printf/bsearch if possible. -20k for static bbox with
"basename", "true" and "false" only. function old new delta full_write2_str - 25 +25 bb_show_usage 183 202 +19 main 883 898 +15 run_applet_and_exit 501 507 +6
Diffstat (limited to 'applets/applet_tables.c')
-rw-r--r--applets/applet_tables.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/applets/applet_tables.c b/applets/applet_tables.c
index 35b099eb4..17135ddc1 100644
--- a/applets/applet_tables.c
+++ b/applets/applet_tables.c
@@ -47,6 +47,7 @@ int main(int argc, char **argv)
{
int i;
int ofs;
+ unsigned MAX_APPLET_NAME_LEN = 1;
qsort(applets, NUM_APPLETS, sizeof(applets[0]), cmp_name);
@@ -71,18 +72,21 @@ int main(int argc, char **argv)
puts("/* This is a generated file, don't edit */\n");
+ printf("#define NUM_APPLETS %u\n", NUM_APPLETS);
if (NUM_APPLETS == 1) {
printf("#define SINGLE_APPLET_STR \"%s\"\n", applets[0].name);
- printf("#define SINGLE_APPLET_MAIN %s_main\n\n", applets[0].name);
+ printf("#define SINGLE_APPLET_MAIN %s_main\n", applets[0].name);
}
- puts("const char applet_names[] ALIGN1 = \"\"");
+ puts("\nconst char applet_names[] ALIGN1 = \"\"");
for (i = 0; i < NUM_APPLETS; i++) {
printf("\"%s\" \"\\0\"\n", applets[i].name);
+ if (MAX_APPLET_NAME_LEN < strlen(applets[i].name))
+ MAX_APPLET_NAME_LEN = strlen(applets[i].name);
}
puts(";");
- puts("int (*const applet_main[])(int argc, char **argv) = {");
+ puts("\nint (*const applet_main[])(int argc, char **argv) = {");
for (i = 0; i < NUM_APPLETS; i++) {
printf("%s_main,\n", applets[i].main);
}
@@ -113,8 +117,10 @@ int main(int argc, char **argv)
printf("0x%02x,\n", v);
i++;
}
- puts("};");
+ puts("};\n");
#endif
+ printf("#define MAX_APPLET_NAME_LEN %u\n", MAX_APPLET_NAME_LEN);
+
return 0;
}