[git commit] hush: make "false" built-in

Denys Vlasenko vda.linux at googlemail.com
Thu May 25 13:24:56 UTC 2023


commit: https://git.busybox.net/busybox/commit/?id=b5be8da350b59ddc1925c485f2acb9c8f5b79b7e
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
bltins1                                              384     396     +12
builtin_false                                          -       6      +6
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 18/0)               Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 shell/hush.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/shell/hush.c b/shell/hush.c
index 1f7b58d4f..cdaa67a3b 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1061,6 +1061,7 @@ static int builtin_export(char **argv) FAST_FUNC;
 #if ENABLE_HUSH_READONLY
 static int builtin_readonly(char **argv) FAST_FUNC;
 #endif
+static int builtin_false(char **argv) FAST_FUNC;
 #if ENABLE_HUSH_JOB
 static int builtin_fg_bg(char **argv) FAST_FUNC;
 static int builtin_jobs(char **argv) FAST_FUNC;
@@ -1161,6 +1162,7 @@ static const struct built_in_command bltins1[] ALIGN_PTR = {
 #if ENABLE_HUSH_EXPORT
 	BLTIN("export"   , builtin_export  , "Set environment variables"),
 #endif
+	BLTIN("false"    , builtin_false   , NULL),
 #if ENABLE_HUSH_JOB
 	BLTIN("fg"       , builtin_fg_bg   , "Bring job to foreground"),
 #endif
@@ -10831,6 +10833,11 @@ static int FAST_FUNC builtin_true(char **argv UNUSED_PARAM)
 	return 0;
 }
 
+static int FAST_FUNC builtin_false(char **argv UNUSED_PARAM)
+{
+	return 1;
+}
+
 #if ENABLE_HUSH_TEST || ENABLE_HUSH_ECHO || ENABLE_HUSH_PRINTF || ENABLE_HUSH_KILL
 static NOINLINE int run_applet_main(char **argv, int (*applet_main_func)(int argc, char **argv))
 {


More information about the busybox-cvs mailing list