aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-10 11:51:45 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-10 11:51:45 +0000
commit311c19a661fb8e8cc85d131c1b87a6b80a89ef7c (patch)
tree70bf2da2e5cac027c9b6479cf61dc48739f6deec
parent6a2d0d9b8d90ba76c2f90fc352acc886bd3e578d (diff)
downloadbusybox-w32-311c19a661fb8e8cc85d131c1b87a6b80a89ef7c.tar.gz
busybox-w32-311c19a661fb8e8cc85d131c1b87a6b80a89ef7c.tar.bz2
busybox-w32-311c19a661fb8e8cc85d131c1b87a6b80a89ef7c.zip
ash: printf builtin with no arguments should not exit
-rw-r--r--coreutils/printf.c9
1 files changed, 8 insertions, 1 deletions
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)
359 * We will mimic coreutils. */ 359 * We will mimic coreutils. */
360 if (argv[1] && argv[1][0] == '-' && argv[1][1] == '-' && !argv[1][2]) 360 if (argv[1] && argv[1][0] == '-' && argv[1][1] == '-' && !argv[1][2])
361 argv++; 361 argv++;
362 if (!argv[1]) 362 if (!argv[1]) {
363 if (ENABLE_ASH_BUILTIN_PRINTF
364 && applet_name[0] != 'p'
365 ) {
366 bb_error_msg("usage: printf FORMAT [ARGUMENT...]");
367 return 2; /* bash compat */
368 }
363 bb_show_usage(); 369 bb_show_usage();
370 }
364 371
365 format = argv[1]; 372 format = argv[1];
366 argv2 = argv + 2; 373 argv2 = argv + 2;