From 311c19a661fb8e8cc85d131c1b87a6b80a89ef7c Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 10 Dec 2008 11:51:45 +0000 Subject: [PATCH] ash: printf builtin with no arguments should not exit --- coreutils/printf.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/coreutils/printf.c b/coreutils/printf.c index 76524f706..b0a48cda4 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c @@ -359,8 +359,15 @@ int printf_main(int argc UNUSED_PARAM, char **argv) * We will mimic coreutils. */ if (argv[1] && argv[1][0] == '-' && argv[1][1] == '-' && !argv[1][2]) argv++; - if (!argv[1]) + if (!argv[1]) { + if (ENABLE_ASH_BUILTIN_PRINTF + && applet_name[0] != 'p' + ) { + bb_error_msg("usage: printf FORMAT [ARGUMENT...]"); + return 2; /* bash compat */ + } bb_show_usage(); + } format = argv[1]; argv2 = argv + 2; -- 2.25.1