aboutsummaryrefslogtreecommitdiff
path: root/applets
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-09-18 00:47:05 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2014-09-18 00:47:05 +0200
commitcd7a38a87d54f5421b379870ff866676f31923b2 (patch)
treeddc2a3e74dcbf1cd0486e01c4f0e6c48bb445988 /applets
parentd0cdacafa98ec0e73e58c2e5a8ba9dded18006df (diff)
downloadbusybox-cd7a38a87d54f5421b379870ff866676f31923b2.tar.gz
false: make "false --help" exit with 1
function old new delta run_applet_no_and_exit 447 445 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'applets')
-rw-r--r--applets/applet_tables.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/applets/applet_tables.c b/applets/applet_tables.c
index 94b974e09..92bf1e447 100644
--- a/applets/applet_tables.c
+++ b/applets/applet_tables.c
@@ -14,6 +14,7 @@
#include <string.h>
#include <stdio.h>
#include <unistd.h>
+#include <ctype.h>
#undef ARRAY_SIZE
#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
@@ -49,6 +50,16 @@ static int cmp_name(const void *a, const void *b)
return strcmp(aa->name, bb->name);
}
+static int str_isalnum_(const char *s)
+{
+ while (*s) {
+ if (!isalnum(*s) && *s != '_')
+ return 0;
+ s++;
+ }
+ return 1;
+}
+
int main(int argc, char **argv)
{
int i;
@@ -94,6 +105,12 @@ int main(int argc, char **argv)
}
printf(";\n\n");
+ for (i = 0; i < NUM_APPLETS; i++) {
+ if (str_isalnum_(applets[i].name))
+ printf("#define APPLET_NO_%s %d\n", applets[i].name, i);
+ }
+ printf("\n");
+
printf("#ifndef SKIP_applet_main\n");
printf("int (*const applet_main[])(int argc, char **argv) = {\n");
for (i = 0; i < NUM_APPLETS; i++) {