From: Bruno Haible Date: Sat, 21 Jun 2025 21:31:17 +0000 (+0200) Subject: awk-format: Accept null precision. X-Git-Tag: v0.26~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2305b059e2574b51791949062923bbcdc9d2a097;p=thirdparty%2Fgettext.git awk-format: Accept null precision. Proof that it's valid: $ echo 3.1415926 | gawk '{ printf "%.f", $1 }' * gettext-tools/src/format-awk.c: Fix comment regarding the precision. * gettext-tools/tests/format-awk-1: Add a test case with null precision. --- diff --git a/gettext-tools/src/format-awk.c b/gettext-tools/src/format-awk.c index ef2036bc2..4ffb90106 100644 --- a/gettext-tools/src/format-awk.c +++ b/gettext-tools/src/format-awk.c @@ -40,7 +40,7 @@ - is optionally followed by a width specification: '*' (reads an argument) or '*m$' or a nonempty digit sequence, - is optionally followed by '.' and a precision specification: '*' (reads - an argument) or '*m$' or a nonempty digit sequence, + an argument) or '*m$' or an optional nonempty digit sequence, - is finished by a specifier - '%', that needs no argument, - 'c', that need a character argument, diff --git a/gettext-tools/tests/format-awk-1 b/gettext-tools/tests/format-awk-1 index ce423cb07..0cb413e27 100755 --- a/gettext-tools/tests/format-awk-1 +++ b/gettext-tools/tests/format-awk-1 @@ -58,6 +58,8 @@ cat <<\EOF > f-a-1.data "abc%F" # Invalid: flags after width "abc%*0g" +# Valid: null precision +"abc%.f" # Invalid: twice precision "abc%.4.2g" # Valid: three arguments