aboutsummaryrefslogtreecommitdiff
path: root/libbb/appletlib.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2020-07-09 13:10:58 +0100
committerRon Yorston <rmy@pobox.com>2020-07-09 13:10:58 +0100
commit9c0b2f7020d7c30b21a930ef54be632e092e533b (patch)
treeb2187c40bd2fd9f49f73599fb08e52cb7a596de0 /libbb/appletlib.c
parenta8c6e20e332a9e11a9d28cd6770eadb9c9d73cb7 (diff)
parentd21a63f9fca8eb16f79de9b72d4a3484dfaec1fc (diff)
downloadbusybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.gz
busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.tar.bz2
busybox-w32-9c0b2f7020d7c30b21a930ef54be632e092e533b.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'libbb/appletlib.c')
-rw-r--r--libbb/appletlib.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 8c46d0d1b..d2f98567e 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -794,7 +794,9 @@ static void install_links(const char *busybox UNUSED_PARAM,
794} 794}
795# endif 795# endif
796 796
797# if ENABLE_BUSYBOX || NUM_APPLETS > 0
797static void run_applet_and_exit(const char *name, char **argv) NORETURN; 798static void run_applet_and_exit(const char *name, char **argv) NORETURN;
799#endif
798 800
799# if NUM_SCRIPTS > 0 801# if NUM_SCRIPTS > 0
800static int find_script_by_name(const char *name) 802static int find_script_by_name(const char *name)
@@ -815,13 +817,13 @@ int scripted_main(int argc UNUSED_PARAM, char **argv)
815{ 817{
816 int script = find_script_by_name(applet_name); 818 int script = find_script_by_name(applet_name);
817 if (script >= 0) 819 if (script >= 0)
818#if ENABLE_ASH || ENABLE_SH_IS_ASH || ENABLE_BASH_IS_ASH 820# if ENABLE_SHELL_ASH
819 exit(ash_main(-script - 1, argv)); 821 exit(ash_main(-script - 1, argv));
820#elif ENABLE_HUSH || ENABLE_SH_IS_HUSH || ENABLE_BASH_IS_HUSH 822# elif ENABLE_SHELL_HUSH
821 exit(hush_main(-script - 1, argv)); 823 exit(hush_main(-script - 1, argv));
822#else 824# else
823 return 1; 825 return 1;
824#endif 826# endif
825 return 0; 827 return 0;
826} 828}
827 829
@@ -1160,7 +1162,33 @@ static NORETURN void run_applet_and_exit(const char *name, char **argv)
1160} 1162}
1161# endif 1163# endif
1162 1164
1163#endif /* !defined(SINGLE_APPLET_MAIN) */ 1165#else /* defined(SINGLE_APPLET_MAIN) */
1166
1167# if NUM_SCRIPTS > 0
1168/* if SINGLE_APPLET_MAIN, these two functions are simpler: */
1169int scripted_main(int argc UNUSED_PARAM, char **argv) MAIN_EXTERNALLY_VISIBLE;
1170int scripted_main(int argc UNUSED_PARAM, char **argv)
1171{
1172# if ENABLE_SHELL_ASH
1173 int script = 0;
1174 exit(ash_main(-script - 1, argv));
1175# elif ENABLE_SHELL_HUSH
1176 int script = 0;
1177 exit(hush_main(-script - 1, argv));
1178# else
1179 return 1;
1180# endif
1181}
1182char* FAST_FUNC
1183get_script_content(unsigned n UNUSED_PARAM)
1184{
1185 char *t = unpack_bz2_data(packed_scripts, sizeof(packed_scripts),
1186 UNPACKED_SCRIPTS_LENGTH);
1187 return t;
1188}
1189# endif /* NUM_SCRIPTS > 0 */
1190
1191#endif /* defined(SINGLE_APPLET_MAIN) */
1164 1192
1165 1193
1166#if ENABLE_BUILD_LIBBUSYBOX 1194#if ENABLE_BUILD_LIBBUSYBOX