diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-01 10:28:04 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2018-11-01 10:28:04 +0100 |
commit | aa2959c90d9c3217ddb6f482b82fef7234ad9bde (patch) | |
tree | 2acd656bf9936d20102817256ad6ed87d7084894 | |
parent | 4f2ef4a836be37b25808c94f41c7c85895db6f93 (diff) | |
download | busybox-w32-aa2959c90d9c3217ddb6f482b82fef7234ad9bde.tar.gz busybox-w32-aa2959c90d9c3217ddb6f482b82fef7234ad9bde.tar.bz2 busybox-w32-aa2959c90d9c3217ddb6f482b82fef7234ad9bde.zip |
claenups for previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/appletlib.c | 36 | ||||
-rw-r--r-- | shell/ash.c | 11 |
2 files changed, 19 insertions, 28 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 08720082e..4e6d1c3d6 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
@@ -964,6 +964,22 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **ar | |||
964 | # endif /* NUM_APPLETS > 0 */ | 964 | # endif /* NUM_APPLETS > 0 */ |
965 | 965 | ||
966 | # if NUM_SCRIPTS > 0 | 966 | # if NUM_SCRIPTS > 0 |
967 | static int | ||
968 | find_script_by_name(const char *arg) | ||
969 | { | ||
970 | const char *s = script_names; | ||
971 | int i = 0; | ||
972 | |||
973 | while (*s) { | ||
974 | if (strcmp(arg, s) == 0) | ||
975 | return i; | ||
976 | i++; | ||
977 | while (*s++ != '\0') | ||
978 | continue; | ||
979 | } | ||
980 | return -1; | ||
981 | } | ||
982 | |||
967 | static char * | 983 | static char * |
968 | unpack_scripts(void) | 984 | unpack_scripts(void) |
969 | { | 985 | { |
@@ -992,26 +1008,6 @@ unpack_scripts(void) | |||
992 | return outbuf; | 1008 | return outbuf; |
993 | } | 1009 | } |
994 | 1010 | ||
995 | /* | ||
996 | * In standalone shell mode we sometimes want the index of the script | ||
997 | * and sometimes the index offset by NUM_APPLETS. | ||
998 | */ | ||
999 | static int | ||
1000 | find_script_by_name(const char *arg) | ||
1001 | { | ||
1002 | const char *s = script_names; | ||
1003 | int i = 0; | ||
1004 | |||
1005 | while (*s) { | ||
1006 | if (strcmp(arg, s) == 0) | ||
1007 | return i; | ||
1008 | i++; | ||
1009 | while (*s++ != '\0') | ||
1010 | continue; | ||
1011 | } | ||
1012 | return -1; | ||
1013 | } | ||
1014 | |||
1015 | char* FAST_FUNC | 1011 | char* FAST_FUNC |
1016 | get_script_content(unsigned n) | 1012 | get_script_content(unsigned n) |
1017 | { | 1013 | { |
diff --git a/shell/ash.c b/shell/ash.c index 25468d796..3adb6d0d2 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -153,15 +153,10 @@ | |||
153 | //config: default y | 153 | //config: default y |
154 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH | 154 | //config: depends on ASH || SH_IS_ASH || BASH_IS_ASH |
155 | //config: help | 155 | //config: help |
156 | //config: Allow scripts to be compressed and embedded in the BusyBox | 156 | //config: Allow scripts to be compressed and embedded in the busybox |
157 | //config: binary. The scripts should be placed in the 'embed' directory | 157 | //config: binary. The scripts should be placed in the 'embed' directory |
158 | //config: at build time. In standalone shell mode such scripts can be | 158 | //config: at build time. Like applets, scripts can be run as |
159 | //config: run directly and are subject to tab completion; otherwise they | 159 | //config: 'busybox SCRIPT ...' or by linking their name to the binary. |
160 | //config: can be run by giving their name as an argument to the shell. | ||
161 | //config: For convenience shell aliases are created. The '-L' shell | ||
162 | //config: argument lists the names of the scripts. Like applets scripts | ||
163 | //config: can be run as 'busybox name ...' or by linking their name to | ||
164 | //config: the binary. | ||
165 | //config: | 160 | //config: |
166 | //config:endif # ash options | 161 | //config:endif # ash options |
167 | 162 | ||