shells: do not frocibly enable test, echo and kill _applets_,

just build relevant source and use xxx_main functions.
build system: add a special case when we have exactly one applet enabled
(makes "true", "false", "basename" REALLY tiny).
getopt32: do not use stdio.

function                                             old     new   delta
getopt32                                            1385    1412     +27
make_device                                         1187    1200     +13
basename_main                                        120     127      +7
tcpudpsvd_main                                      1922    1926      +4
testcmd                                                5       -      -5
echocmd                                                5       -      -5
fuser_main                                          1243    1231     -12
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 4/1 up/down: 51/-22)             Total: 29 bytes
This commit is contained in:
Denis Vlasenko
2008-04-01 14:47:57 +00:00
parent 165f5b394f
commit 468aea2d88
14 changed files with 84 additions and 91 deletions

View File

@@ -8417,12 +8417,6 @@ returncmd(int argc ATTRIBUTE_UNUSED, char **argv)
static int breakcmd(int, char **);
static int dotcmd(int, char **);
static int evalcmd(int, char **);
#if ENABLE_ASH_BUILTIN_ECHO
static int echocmd(int, char **);
#endif
#if ENABLE_ASH_BUILTIN_TEST
static int testcmd(int, char **);
#endif
static int exitcmd(int, char **);
static int exportcmd(int, char **);
#if ENABLE_ASH_GETOPTS
@@ -8464,6 +8458,9 @@ static int ulimitcmd(int, char **);
* Apart from the above, [[ expr ]] should work as [ expr ]
*/
#define testcmd test_main
#define echocmd echo_main
/* Keep these in proper order since it is searched via bsearch() */
static const struct builtincmd builtintab[] = {
{ BUILTIN_SPEC_REG ".", dotcmd },
@@ -11506,22 +11503,6 @@ exitcmd(int argc ATTRIBUTE_UNUSED, char **argv)
/* NOTREACHED */
}
#if ENABLE_ASH_BUILTIN_ECHO
static int
echocmd(int argc, char **argv)
{
return echo_main(argc, argv);
}
#endif
#if ENABLE_ASH_BUILTIN_TEST
static int
testcmd(int argc, char **argv)
{
return test_main(argc, argv);
}
#endif
/*
* Read a file containing shell functions.
*/