printf: Ignore any options

This was misguidedly "fixed" in
9e08609f85, which made printf error out
with any "-"-prefixed words as the first argument.

Note: This means currently `printf --help` doesn't print the help.
This also matches `echo`, and we currently don't have anything to make
a literal `--help` execute a builtin help except for keywords. Oh well.

Fixes #9132
This commit is contained in:
Fabian Boehm
2022-08-10 16:55:56 +02:00
parent c288443b4d
commit 37f7818bbb
2 changed files with 17 additions and 11 deletions

View File

@@ -119,3 +119,18 @@ printf '%d\n' 0g
# CHECKERR: 0g: value not completely converted (can't convert 'g')
echo $status
# CHECK: 1
# Test that we ignore options
printf -a
printf --foo
# CHECK: -a--foo
echo
set -l helpvar --help
printf $helpvar
echo
# CHECK: --help
printf --help
echo
# CHECK: --help