diff options
author | Denis Vlasenko | 2007-11-28 06:49:03 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-11-28 06:49:03 +0000 |
commit | 1aa7e477b1b727db77cac2d717f0fcca40587f78 (patch) | |
tree | 247171517f0e01d32a71a5e96f4bef462cc0e9c6 /shell/msh.c | |
parent | 79c6904faff1ebd4bf4b7d9cd0c20ca70f4cec75 (diff) | |
download | busybox-1aa7e477b1b727db77cac2d717f0fcca40587f78.zip busybox-1aa7e477b1b727db77cac2d717f0fcca40587f78.tar.gz |
reorganize applet table. Eliminates pointers to names.
Should be a big win for libbusybox. busybox wins too:
text data bss dec hex filename
776524 929 9100 786553 c0079 busybox_old
775903 929 9100 785932 bfe0c busybox_unstripped
Diffstat (limited to 'shell/msh.c')
-rw-r--r-- | shell/msh.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/shell/msh.c b/shell/msh.c index 7efd7f9..32953f4 100644 --- a/shell/msh.c +++ b/shell/msh.c @@ -45,9 +45,9 @@ # define NOT_LONE_DASH(s) ((s)[0] != '-' || (s)[1]) # define LONE_CHAR(s,c) ((s)[0] == (c) && !(s)[1]) # define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -static char *find_applet_by_name(const char *applet) +static int find_applet_by_name(const char *applet) { - return NULL; + return -1; } static char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) { @@ -83,7 +83,7 @@ static char *itoa(int n) return local_buf; } #else -# include "busybox.h" +# include "busybox.h" /* for applet_names */ extern char **environ; #endif @@ -3057,7 +3057,7 @@ static const char *rexecve(char *c, char **v, char **envp) char *name = c; if (ENABLE_FEATURE_SH_STANDALONE) { - if (find_applet_by_name(name)) { + if (find_applet_by_name(name) >= 0) { /* We have to exec here since we vforked. Running * run_applet_and_exit() won't work and bad things * will happen. */ @@ -3188,15 +3188,15 @@ static int dohelp(struct op *t) } #if ENABLE_FEATURE_SH_STANDALONE { - const struct bb_applet *applet = applets; + const char *applet = applet_names; - while (applet->name) { - col += printf("%c%s", ((col == 0) ? '\t' : ' '), applet->name); + while (*applet) { + col += printf("%c%s", ((col == 0) ? '\t' : ' '), applet); if (col > 60) { bb_putchar('\n'); col = 0; } - applet++; + applet += strlen(applet) + 1; } } #endif |