svn commit: trunk/busybox/coreutils

vda at busybox.net vda at busybox.net
Wed Dec 10 11:51:46 UTC 2008


Author: vda
Date: 2008-12-10 03:51:45 -0800 (Wed, 10 Dec 2008)
New Revision: 24358

Log:
ash: printf builtin with no arguments should not exit



Modified:
   trunk/busybox/coreutils/printf.c


Changeset:
Modified: trunk/busybox/coreutils/printf.c
===================================================================
--- trunk/busybox/coreutils/printf.c	2008-12-10 11:39:18 UTC (rev 24357)
+++ trunk/busybox/coreutils/printf.c	2008-12-10 11:51:45 UTC (rev 24358)
@@ -359,8 +359,15 @@
 	 * 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;




More information about the busybox-cvs mailing list