diff options
author | Matt Kraai <kraai@debian.org> | 2001-08-27 17:19:38 +0000 |
---|---|---|
committer | Matt Kraai <kraai@debian.org> | 2001-08-27 17:19:38 +0000 |
commit | ab3d839ef455739f8a52e7e44f8f3eed158e2acf (patch) | |
tree | 0791b8d54838eab9d07f749c247dbefa69374835 | |
parent | 861e624e15a0f587d9507d7387541e6cdbad565c (diff) | |
download | busybox-w32-ab3d839ef455739f8a52e7e44f8f3eed158e2acf.tar.gz busybox-w32-ab3d839ef455739f8a52e7e44f8f3eed158e2acf.tar.bz2 busybox-w32-ab3d839ef455739f8a52e7e44f8f3eed158e2acf.zip |
Add support for `busybox --help APPLET' by Vladimir Oleynik.
-rw-r--r-- | applets.c | 19 | ||||
-rw-r--r-- | applets/applets.c | 19 |
2 files changed, 22 insertions, 16 deletions
@@ -45,13 +45,6 @@ extern void show_usage(void) | |||
45 | const char *format_string; | 45 | const char *format_string; |
46 | const char *usage_string = usage_messages; | 46 | const char *usage_string = usage_messages; |
47 | int i; | 47 | int i; |
48 | /* From busybox.c */ | ||
49 | extern int been_there_done_that; | ||
50 | |||
51 | if (strcmp(applet_using->name, "busybox")==0) { | ||
52 | been_there_done_that=1; | ||
53 | busybox_main(0, NULL); | ||
54 | } | ||
55 | 48 | ||
56 | for (i = applet_using - applets; i > 0; ) { | 49 | for (i = applet_using - applets; i > 0; ) { |
57 | if (!*usage_string++) { | 50 | if (!*usage_string++) { |
@@ -85,13 +78,23 @@ struct BB_applet *find_applet_by_name(const char *name) | |||
85 | void run_applet_by_name(const char *name, int argc, char **argv) | 78 | void run_applet_by_name(const char *name, int argc, char **argv) |
86 | { | 79 | { |
87 | static int recurse_level = 0; | 80 | static int recurse_level = 0; |
81 | extern int been_there_done_that; /* From busybox.c */ | ||
88 | 82 | ||
89 | recurse_level++; | 83 | recurse_level++; |
90 | /* Do a binary search to find the applet entry given the name. */ | 84 | /* Do a binary search to find the applet entry given the name. */ |
91 | if ((applet_using = find_applet_by_name(name)) != NULL) { | 85 | if ((applet_using = find_applet_by_name(name)) != NULL) { |
92 | applet_name = applet_using->name; | 86 | applet_name = applet_using->name; |
93 | if (argv[1] && strcmp(argv[1], "--help") == 0) { | 87 | if (argv[1] && strcmp(argv[1], "--help") == 0) { |
94 | show_usage(); | 88 | if (strcmp(applet_using->name, "busybox")==0) { |
89 | if(argv[2]) | ||
90 | applet_using = find_applet_by_name(argv[2]); | ||
91 | else | ||
92 | applet_using = NULL; | ||
93 | } | ||
94 | if(applet_using) | ||
95 | show_usage(); | ||
96 | been_there_done_that=1; | ||
97 | busybox_main(0, NULL); | ||
95 | } | 98 | } |
96 | exit((*(applet_using->main)) (argc, argv)); | 99 | exit((*(applet_using->main)) (argc, argv)); |
97 | } | 100 | } |
diff --git a/applets/applets.c b/applets/applets.c index ffa806ebc..f3e56a9f3 100644 --- a/applets/applets.c +++ b/applets/applets.c | |||
@@ -45,13 +45,6 @@ extern void show_usage(void) | |||
45 | const char *format_string; | 45 | const char *format_string; |
46 | const char *usage_string = usage_messages; | 46 | const char *usage_string = usage_messages; |
47 | int i; | 47 | int i; |
48 | /* From busybox.c */ | ||
49 | extern int been_there_done_that; | ||
50 | |||
51 | if (strcmp(applet_using->name, "busybox")==0) { | ||
52 | been_there_done_that=1; | ||
53 | busybox_main(0, NULL); | ||
54 | } | ||
55 | 48 | ||
56 | for (i = applet_using - applets; i > 0; ) { | 49 | for (i = applet_using - applets; i > 0; ) { |
57 | if (!*usage_string++) { | 50 | if (!*usage_string++) { |
@@ -85,13 +78,23 @@ struct BB_applet *find_applet_by_name(const char *name) | |||
85 | void run_applet_by_name(const char *name, int argc, char **argv) | 78 | void run_applet_by_name(const char *name, int argc, char **argv) |
86 | { | 79 | { |
87 | static int recurse_level = 0; | 80 | static int recurse_level = 0; |
81 | extern int been_there_done_that; /* From busybox.c */ | ||
88 | 82 | ||
89 | recurse_level++; | 83 | recurse_level++; |
90 | /* Do a binary search to find the applet entry given the name. */ | 84 | /* Do a binary search to find the applet entry given the name. */ |
91 | if ((applet_using = find_applet_by_name(name)) != NULL) { | 85 | if ((applet_using = find_applet_by_name(name)) != NULL) { |
92 | applet_name = applet_using->name; | 86 | applet_name = applet_using->name; |
93 | if (argv[1] && strcmp(argv[1], "--help") == 0) { | 87 | if (argv[1] && strcmp(argv[1], "--help") == 0) { |
94 | show_usage(); | 88 | if (strcmp(applet_using->name, "busybox")==0) { |
89 | if(argv[2]) | ||
90 | applet_using = find_applet_by_name(argv[2]); | ||
91 | else | ||
92 | applet_using = NULL; | ||
93 | } | ||
94 | if(applet_using) | ||
95 | show_usage(); | ||
96 | been_there_done_that=1; | ||
97 | busybox_main(0, NULL); | ||
95 | } | 98 | } |
96 | exit((*(applet_using->main)) (argc, argv)); | 99 | exit((*(applet_using->main)) (argc, argv)); |
97 | } | 100 | } |