aboutsummaryrefslogtreecommitdiff
path: root/libbb/executable.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/executable.c')
-rw-r--r--libbb/executable.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libbb/executable.c b/libbb/executable.c
index 85ecc3e6c..05e70312f 100644
--- a/libbb/executable.c
+++ b/libbb/executable.c
@@ -83,10 +83,19 @@ int FAST_FUNC BB_EXECVP(const char *file, char *const argv[])
}
#endif
-int FAST_FUNC BB_EXECVP_or_die(char **argv)
+void FAST_FUNC BB_EXECVP_or_die(char **argv)
{
BB_EXECVP(argv[0], argv);
/* SUSv3-mandated exit codes */
xfunc_error_retval = (errno == ENOENT) ? 127 : 126;
bb_perror_msg_and_die("can't execute '%s'", argv[0]);
}
+
+/* Typical idiom for applets which exec *optional* PROG [ARGS] */
+void FAST_FUNC exec_prog_or_SHELL(char **argv)
+{
+ if (argv[0]) {
+ BB_EXECVP_or_die(argv);
+ }
+ run_shell(getenv("SHELL"), /*login:*/ 1, NULL, NULL);
+}