aboutsummaryrefslogtreecommitdiff
path: root/coreutils/printf.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-10-02 13:56:32 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-10-02 13:56:32 +0200
commit791b222dd55d3aa0e8b09be1be571e4829465dd6 (patch)
tree64af8d2c7a5787055bacb15c8a9f20ed51c2732f /coreutils/printf.c
parent2cc9d436e80632157b99e18d413a62b2d44d321a (diff)
downloadbusybox-w32-791b222dd55d3aa0e8b09be1be571e4829465dd6.tar.gz
busybox-w32-791b222dd55d3aa0e8b09be1be571e4829465dd6.tar.bz2
busybox-w32-791b222dd55d3aa0e8b09be1be571e4829465dd6.zip
sleep: fix "sleep -- ARGS"
function old new delta sleep_main 116 119 +3 printf_main 860 837 -23 single_argv 50 25 -25 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 3/-48) Total: -45 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/printf.c')
-rw-r--r--coreutils/printf.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 7763d7c46..4edcfa9b5 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -425,9 +425,9 @@ int printf_main(int argc UNUSED_PARAM, char **argv)
425 /* bash builtin errors out on "printf '-%s-\n' foo", 425 /* bash builtin errors out on "printf '-%s-\n' foo",
426 * coreutils-6.9 works. Both work with "printf -- '-%s-\n' foo". 426 * coreutils-6.9 works. Both work with "printf -- '-%s-\n' foo".
427 * We will mimic coreutils. */ 427 * We will mimic coreutils. */
428 if (argv[1] && argv[1][0] == '-' && argv[1][1] == '-' && !argv[1][2]) 428 argv = skip_dash_dash(argv);
429 argv++; 429
430 if (!argv[1]) { 430 if (!argv[0]) {
431 if ((ENABLE_ASH_PRINTF || ENABLE_HUSH_PRINTF) 431 if ((ENABLE_ASH_PRINTF || ENABLE_HUSH_PRINTF)
432 && applet_name[0] != 'p' 432 && applet_name[0] != 'p'
433 ) { 433 ) {
@@ -437,8 +437,8 @@ int printf_main(int argc UNUSED_PARAM, char **argv)
437 bb_show_usage(); 437 bb_show_usage();
438 } 438 }
439 439
440 format = argv[1]; 440 format = argv[0];
441 argv2 = argv + 2; 441 argv2 = argv + 1;
442 442
443 conv_err = 0; 443 conv_err = 0;
444 do { 444 do {